From 31687da9311a3615ff18f76e90927b8227efea3c Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 3 May 2023 15:00:10 +0100 Subject: [PATCH] celldice: actually do log(cosh()) ....just wow. --- aimodel/src/lib/ai/components/LossCrossEntropyDice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aimodel/src/lib/ai/components/LossCrossEntropyDice.py b/aimodel/src/lib/ai/components/LossCrossEntropyDice.py index 25cee09..4a8169a 100644 --- a/aimodel/src/lib/ai/components/LossCrossEntropyDice.py +++ b/aimodel/src/lib/ai/components/LossCrossEntropyDice.py @@ -38,6 +38,9 @@ class LossCrossEntropyDice(tf.keras.losses.Loss): cel = tf.nn.sigmoid_cross_entropy_with_logits(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 return tf.reduce_mean(o)