Course 2, Week 3 Assignment, Exercise 6

Hello,
I am enrolled in the Neural Network and Deep Learning Module having difficulty completing Exercise 6 of the Week 3 assignment of Course 2.

I believe I have written the equation for the total loss correctly, using TensorFlow functions given for the calculation of loss and for the sum over the losses, and by defining true and predicted output values using the given arguments of the total loss function. However when I run the cell I receive a Test 1 error message that asks me if I got the reduce sum of the loss functions, which I’m pretty sure I have. So I am confused by the error message and I would like some clarification as to where I have made an error in the equation.
Thank you.

The error messages are not always that precise in terms of interpreting what your mistake might be. Here’s a thread that gives a checklist of possible errors in that function. Of course that is also not guaranteed to cover every possible case, but it’s definitely worth a look.

If that checklist doesn’t get you there, the next step would be for you to show us your actual output from the failing test. The actual incorrect value produced is another good clue …

Thank you for your reply, I will look through the checklist to verify if it helps. I have already passed the assignment overall so it’s not urgent, but I still want to understand where the error comes from.

Hello again. Thank you for the checklist thread, it was helpful. I had not initially transposed the inputs.

It’s great to hear that you were able to find the solution based on that other thread. Thanks for confirming.

Here’s another historical thread that discusses why the transpose is required there.

I hope you found DLS Course 2 valuable and that you will continue onward with DLS. There is a lot more to come. In particular, Course 4 about Convolutional Networks and Course 5 about Sequence Models are essential to understanding the basis for a lot of the ML/DL technology that has been created in the last 10 years.