fine tune sparse_categorical_crossentropy
@@ -3611,7 +3611,7 @@ def sparse_categorical_crossentropy(target, output, from_logits=False, axis=-1):
output_shape = output.get_shape()
targets = cast(flatten(target), 'int64')
- logits = tf.reshape(output, [-1, int(output_shape[-1])])
+ logits = tf.reshape(output, [-1, tf.shape(output)[-1]])
res = tf.nn.sparse_softmax_cross_entropy_with_logits(
labels=targets,
logits=logits)
