-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
With the add_loss API (https://keras.io/api/losses/#the-addloss-api) layers can add arbitrary losses that need not depend on the output of the network.
This is a useful feature for example if a custom layer needs to be regularized in a special way.
It basically works like this:
layer_1.add_loss adds loss tensors to a layer_1.losses list and parent layers/models have a joint losses attribute containing all these layer losses.
Currently, these losses are silently ignored in approximator.fit.
We can actually support add_loss with minimal changes by taking the self.losses into account in approximator.compute_metrics.
paul-buerkner