I reshaped Logits and labels on there own lines because it was easier to analyze. I have tried every thing I could by scanning through Forums and I just can’t get it right. I am getting it very close. Where and I miss understadning or typed wrong. Did I get the wrong num_classes. I just don’t know

pred= tf.cast(tf.reshape(logits,[tf.shape(logits)[1],6]), dtype = tf.float32)

true = tf.cast(tf.reshape(labels,[tf.shape(logits)[1],6]), dtype = tf.float32)

cost = tf.reduce_mean(tf.keras.losses.categorical_crossentropy(true,pred, from_logits=True))

Output

tf.Tensor(0.2490923, shape=(), dtype=float32)

Expected output

tf.Tensor(0.4051435, shape=(), dtype=float32)