Skip to content

Commit

Permalink
Uniformize naming of layers in NN
Browse files Browse the repository at this point in the history
  • Loading branch information
APJansen committed Feb 21, 2024
1 parent a6f77f4 commit 2b4168a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions n3fit/src/n3fit/backends/keras_backend/base_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ def base_layer_selector(layer_name, **kwargs):
value = custom_activations.get(value, value)
if key in layer_args.keys():
layer_args[key] = value
if key == "name":
layer_args[key] = value

return layer_class(**layer_args)

Expand Down
11 changes: 5 additions & 6 deletions n3fit/src/n3fit/model_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def _generate_loss(self, mask=None):
if self.invcovmat is not None:
if self.rotation:
# If we have a matrix diagonal only, padd with 0s and hope it's not too heavy on memory
invcovmat_matrix = np.eye(self.invcovmat.shape[-1]) * self.invcovmat[..., np.newaxis]
invcovmat_matrix = (
np.eye(self.invcovmat.shape[-1]) * self.invcovmat[..., np.newaxis]
)
if self.covmat is not None:
covmat_matrix = np.eye(self.covmat.shape[-1]) * self.covmat[..., np.newaxis]
else:
Expand All @@ -82,11 +84,7 @@ def _generate_loss(self, mask=None):
covmat_matrix = self.covmat
invcovmat_matrix = self.invcovmat
loss = losses.LossInvcovmat(
invcovmat_matrix,
self.data,
mask,
covmat=covmat_matrix,
name=self.name
invcovmat_matrix, self.data, mask, covmat=covmat_matrix, name=self.name
)
elif self.positivity:
loss = losses.LossPositivity(name=self.name, c=self.multiplier)
Expand Down Expand Up @@ -759,6 +757,7 @@ def layer_generator(i_layer, nodes_out, activation):
activation=activation,
is_first_layer=(i_layer == 0),
regularizer=reg,
name=f"multi_dense_{i_layer}",
)

else:
Expand Down

0 comments on commit 2b4168a

Please sign in to comment.