I have been debugging the failed tests with Backward Propagation (4.5, exercise 6) implementation, where it says dW1 computed has wrong values. I suspect I am doing something wrong in dZ1 computation, which is having a cascading effect on dW1 and db1. Appreciate some pointers with this.

I have cross verified multiple times and followed exact same equations as per the lecture and the equations provided in the notebook as attached.

I understand I can’t paste the code here. Here is a quick description of what I do instead of pasting the code here. I hope it’s okay to describe this way.

- For dZ1, I compute in 3 steps -
**1)**compute dot product of W2.T, dZ2**2)**compute g[1]′(Z[1]) using`(1 - np.power(A1, 2))`

**3)**Element wise multiply 1) and 2) and then multiply with 1/m - For dW1, I compute a dot product of dZ1 and X.T and then multiply with 1/m
- For db1, I compute np.sum of dZ1 with axis 1, keepdims True and then multiply with 1/m

Out of the expected assertions of the test, I see that dW2, db2 values and shapes are matching, where as dW1 and db1 don’t match with values, but shape is correct. All previous sections work fine with tests passed. Any clues please? The output traces of dW1, db1, dW2, db2 are attached.

Thanks,

Prakash