Skip to content

Commit

Permalink
Uniformize namings with builder_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
APJansen committed Jul 17, 2023
1 parent f856911 commit 4998185
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions n3fit/src/n3fit/layers/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
super().__init__(**kwargs)

def generate_weight(self,
weight_name: str,
name: str,
kind: str,
dictionary: dict,
set_to_zero: bool = False
Expand All @@ -63,7 +63,7 @@ def generate_weight(self,
Parameters
----------
weight_name: str
name: str
name to be given to the generated weight
kind: str
where to find the limits of the weight in the dictionary
Expand All @@ -72,7 +72,7 @@ def generate_weight(self,
set_to_zero: bool
set the weight to constant 0
"""
weight_constraint = None
constraint = None
if set_to_zero:
initializer = MetaLayer.init_constant(0.0)
trainable = False
Expand All @@ -86,15 +86,15 @@ def generate_weight(self,
self.seed += 1
# If we are training, constrain the weights to be within the limits
if trainable:
weight_constraint = constraints.MinMaxWeight(minval, maxval)
constraint = constraints.MinMaxWeight(minval, maxval)

# Generate the new trainable (or not) parameter
newpar = self.builder_helper(
name=weight_name,
name=name,
kernel_shape=(1,),
initializer=initializer,
trainable=trainable,
constraint=weight_constraint,
constraint=constraint,
)
return newpar

Expand Down

0 comments on commit 4998185

Please sign in to comment.