[Course 2][Week 1] [Excercise 4] issue in difference

I couldn’t pass step 25.

I always receive this error : “There is a mistake in the backward propagation! difference = 0.2850931567761623”

I tried to debug my code to see how much error I have.

numerator = np.linalg.norm(grad-gradapprox)
print('diff : ',grad-gradapprox)

My code seems to be correct but why I have high errors in few samples ?!

output of the print :

diff : [[-4.79640099e-08]
[-2.54472029e-07]
[ 9.53916665e-08]
[ 1.70220900e-07]
[-1.67835969e-07]
[-3.10650237e-07]
[-1.20181972e-08]
[-3.47152917e-07]
[-1.43196197e-09]
[-9.39146240e-10]
[ 5.18748940e-10]
[ 3.70057027e-10]
[-1.08719177e-07]
[ 2.10843253e-07]
[-6.96707532e-08]
[-1.26077650e-07]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 1.89872354e+00]
[ 1.11754485e-01]
** [-1.92039040e-01]**
** [ 2.71367551e-01]**
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 9.15801603e-01]
** [ 2.45155377e-02]**
** [-1.07979537e-01]**
** [ 9.02819030e-01]**
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 0.00000000e+00]
[-1.32643517e-08]
[ 0.00000000e+00]
[ 0.00000000e+00]
[ 1.10427310e-07]
[ 1.04333515e-07]]

This is slightly tricky testing. :slight_smile:
This test program expects two different values.

expected_values = [0.2850931567761623, 1.1890913024229996e-07]

So, if your output is one of the above two, that should be fine.

There are two intentional errors in “backword_propagation_n()”. Later, as an optional assignment, you will have a chance to correct those. Then, the output should be

Your backward propagation works perfectly fine! difference = 1.1890913023330276e-07