Assignment week 3

Could you please tell me what the problem is?
I have tried it with all notices, but it does not pass the test.

(Solution code removed, as posting it publicly is against the honour code of this community)

Hi @Areeg_Fahad,

Just under the heading Exercise 6 - compute_total_loss, it says "

  • tf.reduce_sum does the summation over the examples.”

Keeping that in mind, what you are using is tf.reduce_mean function. Use the appropriate function and adjust the parameters accordingly.

Best,
Mubsi

1 Like

Note the last part of Mubsi’s comment: using the wrong function there (mean instead of sum) is not the only issue with your code. Have another careful look at the dimensions of the inputs. Also note that you’ll need the from_logits parameter there, as discussed on this thread.

1 Like

Exercise 6 - compute_total_loss

Implement the total loss function below. You will use it to compute the total loss of a batch of samples. With this convenient function, you can sum the losses across many batches, and divide the sum by the total number of samples to get the cost value.

But in exercise we use only “tf.reduce_sum” with out dividing… Why?

1 Like

Please see this other recent thread for the explanation.

1 Like

Thank you for clarifying.