Skip to content

Commit 462baee

Browse files
committed
Increase the epsilon value in the cross entropy implementation to try to
avoid NaNs.
1 parent 525a13a commit 462baee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

losses.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CrossEntropyLoss(BaseLoss):
4343

4444
def calculate_loss(self, predictions, labels, **unused_params):
4545
with tf.name_scope("loss_xent"):
46-
epsilon = 10e-8
46+
epsilon = 10e-6
4747
float_labels = tf.cast(labels, tf.float32)
4848
cross_entropy_loss = float_labels * tf.log(predictions + epsilon) + (
4949
1 - float_labels) * tf.log(1 - predictions + epsilon)

0 commit comments

Comments
 (0)