Skip to content

Commit

Permalink
Removed cast only in sparse categorical cross entropy loss
Browse files Browse the repository at this point in the history
  • Loading branch information
old-school-kid authored Jul 28, 2021
1 parent ca3da0c commit f175038
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion keras/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ def categorical_hinge(y_true, y_pred):
Categorical hinge loss values.
"""
y_pred = tf.convert_to_tensor(y_pred)

y_true = tf.cast(y_true, y_pred.dtype)
pos = tf.reduce_sum(y_true * y_pred, axis=-1)
neg = tf.reduce_max((1. - y_true) * y_pred, axis=-1)
zero = tf.cast(0., y_pred.dtype)
Expand Down

0 comments on commit f175038

Please sign in to comment.