W3_A1_Ex-6_backward_propagation [AssertionError: Wrong values for dW1]

Hi, Hichem.

Your code is correct from a mathematical point of view, but I explained earlier on this thread why it doesn’t work with the test cases they have here. Their test cases are not correctly constructed because the Z1 and A1 values are not related. The relationship should be:

A1 = np.tanh(Z1)

But you can see in this post that it’s not. So you just have to write the g'(Z1) expression as (1 - A1^2) in order to pass the tests there. You have A1 in the cache, so it’s actually more efficient to write it that way in any case. The code will run faster because computing tanh is non-trivial (you need to evaluate e^x). They also gave you a very explicit hint to do it that way in the instructions for this section.