Week 3 Programming Assignment Exercise 6

Can you help me with backward_propagation

I got stuck in calculations

Below is my code

[snippet removed by mentor]

according to results I see that dW2 and db2 are correctly calculated.
But dW1 and db1 are wrong
Seems I have a mistake in calculation of dZ1 but I cannot figure out what.

My error

AssertionError                            Traceback (most recent call last)
<ipython-input-76-a06d396e2b09> in <module>
      7 print ("db2 = "+ str(grads["db2"]))
----> 9 backward_propagation_test(backward_propagation)

~/work/release/W3A1/public_tests.py in backward_propagation_test(target)
    187     assert output["db2"].shape == expected_output["db2"].shape, f"Wrong shape for db2."
--> 189     assert np.allclose(output["dW1"], expected_output["dW1"]), "Wrong values for dW1"
    190     assert np.allclose(output["db1"], expected_output["db1"]), "Wrong values for db1"
    191     assert np.allclose(output["dW2"], expected_output["dW2"]), "Wrong values for dW2"

AssertionError: Wrong values for dW1

found the mistake

{moderator edit - solution code removed}

should be

[snippet removed by mentor]

Hey @Mykhailo_Poliakov,
Welcome to the community. Thanks for letting us know that your issue has been rectified.


Hello, Mykhailo Poliakov.

Here’s a request that I would like to highlight upon on behalf of DeepLearning.AI community platform:

We hope that you are enjoying our community platform hosted on Discourse. As we strive to continuously improve our platform, we would like to gather your feedback and insights to better understand your needs and preferences.

We invite you to participate in a brief survey that will help us identify areas where we can enhance the platform to better serve your needs. Your participation in [**this survey**](https://forms.gle/qb9iQwFibucN8asj8) is completely voluntary, and all responses will be kept confidential.

To access the survey, please click on the link provided in this message. It should take no more than 10 minutes to complete.

Your honest and thoughtful feedback is greatly appreciated, and will help us to make the community platform an even better resource for learners like you.

Thank you for your time and input!

Kindly share your feedback!


That is not the correct formula for the derivative of tanh. Please see the instructions: they tell you the formula to use and are even are nice enough to write out the code for you.

yeah, found the error