logits = tf.transpose(logits)

labels = tf.transpose(labels)

```
cost = tf.reduce_mean(tf.keras.losses.categorical_crossentropy(y_true = labels,y_pred = logits))
```

Error Message: Shapes (2, 4) and (2, 6) are incompatible

[Removed solution code]

logits = tf.transpose(logits)

labels = tf.transpose(labels)

```
cost = tf.reduce_mean(tf.keras.losses.categorical_crossentropy(y_true = labels,y_pred = logits))
```

Error Message: Shapes (2, 4) and (2, 6) are incompatible

[Removed solution code]

1 Like

As you are not applying the softmax function on the logits, you need to put â€śfrom_logits = Trueâ€ť in your categorical crossentropy function.

y_true = labels, y_pred = logits

apply this

1 Like