celldice: actually do log(cosh())

....just wow.
This commit is contained in:
Starbeamrainbowlabs 2023-05-03 15:00:10 +01:00
parent 4a4df380e3
commit 31687da931
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -38,6 +38,9 @@ class LossCrossEntropyDice(tf.keras.losses.Loss):
cel = tf.nn.sigmoid_cross_entropy_with_logits(y_true, y_pred) cel = tf.nn.sigmoid_cross_entropy_with_logits(y_true, y_pred)
dice = dice_loss(y_true, y_pred) dice = dice_loss(y_true, y_pred)
if self.param_log_cosh:
dice = tf.math.log(tf.math.cosh(dice))
o = cel + dice o = cel + dice
return tf.reduce_mean(o) return tf.reduce_mean(o)