Skip to content Skip to sidebar Skip to footer

Tensorflow Label And Logits Shapes Are Incompatible

I have following code in Tensorflow with custom estimator that is created with Keras. It errors out on loss function loss = tf.losses.sigmoid_cross_entropy(multi_class_labels=label

Solution 1:

Okay. If labels is a Tensor, use the tf.reshape() method and run:

labels = tf.reshape(labels, [-1, 1])

Else, if it is a Numpy array, do:

labels = np.reshape(labels, (-1, 1))

Post a Comment for "Tensorflow Label And Logits Shapes Are Incompatible"