Hi, my code for compute cost did not return the expected answer and I got the message: “Test does not match. Did you get the mean of your cost functions?”
I followed the assignment instructions:
cost = tf.reduce_mean(tf.keras.losses.binary_crossentropy(y_true = labels, y_pred = logits, from_logits=True))
Any idea of what can be wrong?
thank you @mc04xkf ! It worked, but I also had to use tf.transpose() to correct the shape of the parameters.
2 Likes
Hello, thanks both for these useful insights. I am having a hard time getting my head around the differences of tf.keras.losses.categorical_crossentropy
and tf.keras.metrics.categorical_crossentropy
. I have used tf.keras.losses.categorical_crossentropy
, but get the same error as Rogelio (then implemented the suggested code here and all works). Would be grateful if anyone can shed some light to my beginners question. Thanks!
I was using the correct function but didn’t transpose the parameters so it was giving me the wrong values. Thank you for sharing what else helped you to work it out.