Hi,
I keep getting this error despite dW1 matching exactly with the expected dW1 result
To be more precise, to compute dW1 I implemented this expression:
dZ1 = np.dot(W2.T, dZ2) *(1 - np.tanh(cache['Z1'])**2)
dW1 = 1/m * np.dot(dZ1, X.T)
The result for dZ1 in my implementation is:
dW1 = [[ 0.00301023 -0.00747267]
[ 0.00257968 -0.00641288]
[-0.00156892 0.003893 ]
[-0.00652037 0.01618243]]
Thus matching the expected output for dW1
Expected output
dW1 = [[ 0.00301023 -0.00747267]
[ 0.00257968 -0.00641288]
[-0.00156892 0.003893 ]
[-0.00652037 0.01618243]]
This is the complete traceback
AssertionError Traceback (most recent call last)
<ipython-input-48-a06d396e2b09> in <module>
7 print ("db2 = "+ str(grads["db2"]))
8
----> 9 backward_propagation_test(backward_propagation)
~/work/release/W3A1/public_tests.py in backward_propagation_test(target)
177 assert output["db2"].shape == expected_output["db2"].shape, f"Wrong shape for db2."
178
--> 179 assert np.allclose(output["dW1"], expected_output["dW1"]), "Wrong values for dW1"
180 assert np.allclose(output["db1"], expected_output["db1"]), "Wrong values for db1"
181 assert np.allclose(output["dW2"], expected_output["dW2"]), "Wrong values for dW2"
AssertionError: Wrong values for dW1
Am I missing something?

