Skip to content

Commit

Permalink
allow any kind of initialiser for the generation of the prepro exponents
Browse files Browse the repository at this point in the history
  • Loading branch information
comane committed Dec 13, 2024
1 parent 9aaad26 commit 0109ff9
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 @@ -76,15 +76,15 @@ def generate_weight(self, name: str, kind: str, dictionary: dict, set_to_zero: b
single_replica_initializer = MetaLayer.init_constant(0.0)
trainable = False
else:
minval, maxval = dictionary[kind]
prepro_kwargs = dictionary[kind]
trainable = dictionary.get("trainable", True)
# Seeds will be set in the wrapper MultiInitializer
single_replica_initializer = MetaLayer.select_initializer(
"random_uniform", minval=minval, maxval=maxval
)
single_replica_initializer = MetaLayer.select_initializer(**prepro_kwargs)
# If we are training, constrain the weights to be within the limits
if trainable:
constraint = constraints.MinMaxWeight(minval, maxval)
if trainable and prepro_kwargs["ini_name"] == "random_uniform":
constraint = constraints.MinMaxWeight(
prepro_kwargs["minval"], prepro_kwargs["maxval"]
)

initializer = MultiInitializer(single_replica_initializer, self._replica_seeds, base_seed=0)
# increment seeds for the next coefficient
Expand Down

0 comments on commit 0109ff9

Please sign in to comment.