Add axis type check
Added type check to axis to accept only integers.
@@ -1773,7 +1773,9 @@ def categorical_crossentropy(y_true,
Returns:
Categorical crossentropy loss value.
"""
- axis = int(axis)
+ if isinstance(axis, bool):
+ raise ValueError(
+ '`axis` must be of type `int`.')
y_pred = tf.convert_to_tensor(y_pred)
y_true = tf.cast(y_true, y_pred.dtype)
label_smoothing = tf.convert_to_tensor(label_smoothing, dtype=y_pred.dtype)
