Exercise 6: compute_total_loss

I have written the following code

{moderator edit - solution code removed}

but the following error is being shown:

AssertionError: Test does not match. Did you get the reduce sum of your loss functions?

Any help in this issue ?

Please share your full error with week and assignment number.

DLS Course 2: Programming Assignment, TensorFlow Introduction, Exercise 6: compute_total_loss

total_loss = tf.reduce_mean(tf.keras.losses.categorical_crossentropy(y_true = tf.transpose(labels),y_pred = tf.transpose(logits),from_logits = True))

I am using the above code to calculate the loss.

The problem is that you are using reduce_mean instead of reduce_sum. They talked about that in the instructions. Here’s a thread which explains in more detail why they do it that way.

Thanks @paulinpaloalto. I overlooked it.