From 0109ff909a00b984c91b1add578347d5091b71cf Mon Sep 17 00:00:00 2001 From: Mark Nestor Costantini Date: Fri, 13 Dec 2024 13:59:33 +0000 Subject: [PATCH] allow any kind of initialiser for the generation of the prepro exponents --- n3fit/src/n3fit/layers/preprocessing.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/n3fit/src/n3fit/layers/preprocessing.py b/n3fit/src/n3fit/layers/preprocessing.py index b716f8f398..78179db327 100644 --- a/n3fit/src/n3fit/layers/preprocessing.py +++ b/n3fit/src/n3fit/layers/preprocessing.py @@ -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