Skip to content

Commit

Permalink
recover previous behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlehoff committed Mar 4, 2024
1 parent 5231f38 commit e8f79c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions n3fit/src/n3fit/backends/keras_backend/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ def __init__(self, stopping_object, log_freq=100):
super().__init__()
self.log_freq = log_freq
self.stopping_object = stopping_object
self._current_loss = None

def on_epoch_begin(self, epoch, logs=None):
# TODO This is an unnecessary performance hit, just for testing
self._current_loss = self.model.compute_losses()

def on_epoch_end(self, epoch, logs=None):
""" Function to be called at the end of every epoch """
logs = self._current_loss
print_stats = ((epoch + 1) % self.log_freq) == 0
# Note that the input logs correspond to the fit before the weights are updated
self.stopping_object.monitor_chi2(logs, epoch, print_stats=print_stats)
Expand Down
1 change: 0 additions & 1 deletion n3fit/src/n3fit/backends/keras_backend/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __init__(self, min_value, max_value, **kwargs):
min_value=min_value, max_value=max_value, **kwargs
)

@tf.function
def __call__(self, w):
norms = K.sum(w, axis=self.axis, keepdims=True)
desired = (
Expand Down

0 comments on commit e8f79c0

Please sign in to comment.