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.