Course 1 --> week 2 --> Exercise 5

please, help!!!
Propagate function doesn’t work well and raise error

<ipython-input-51-7cd89fb9dcd2> in <module>
      6 
      7 assert type(grads["dw"]) == np.ndarray
----> 8 assert grads["dw"].shape == (2, 1)
      9 assert type(grads["db"]) == np.float64
     10 

AssertionError: 

Hi there, it means that the shape of ‘dw’ is not correct. Please check.

I know that
but I can’t find the reason for the problem, I followed the instructions and my code is correct.

Can you print out the shape of grads[“dw”], is it of shape (2,1)?

(3, 1)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-53-7cd89fb9dcd2> in <module>
      6 
      7 assert type(grads["dw"]) == np.ndarray
----> 8 assert grads["dw"].shape == (2, 1)
      9 assert type(grads["db"]) == np.float64
     10 

AssertionError: 

all results is correct except dw

Because this assert() statement is the second check following the variable type check in line7, which might successfully passed.
This error indicates that your calculated dw is of wrong shape, could you check your calculation of dw, remember, dw={{1\over{m}}*X(A-Y)^T}.

thanks a lot
I forgot to use the dot function instead, I used element-wise multiplication :man_facepalming:
thanks for the help again :smiley:

Hello everyone,

I go the same ERROR here. Although I used np.dot() and I have checked my code several times but the result will be an array of (2,2). I don’t know what I did wrong or how I should fix this error, pls help.