i am not sure how to update W1, use W1 = W1 - learning_rate * dJ/dW1
how to present dJ/dW1?
They give you the formulas for computing dW1 and dW2 in the instructions. They end up being matrices with the same shape as W1 and W2 respectively.
Hi Lucy,
Please go through the instructions again, where it is clearly mentioned. Here’s a screenshot.
You just need to apply the formula using the inputs.
Happy Learning!
hi Rashmi, thanks, may i ask why still wrong i use, W1 = W1 - learning_rate * dW1?
That is the correct formula. So if you get an error, it must mean that your dW1 value is incorrect. What shape is it?
hi i use dW1 = grads[“dW1”] as dW1, may i ask why not correct?
That should be correct.
Which test is failing? Is it the unit test for update_parameters or is it one of the other tests?
that is so strange, here are all my code, may i ask where is the error?
{moderator edit - solution code removed}
the error is : AssertionError: Wrong shape for W1.
That all looks correct. Are you sure you’ve executed all the cells since the last change you made? Just typing new code in a cell doesn’t do anything unless you click “Shift-Enter” on that cell. Just calling the function again runs the old code.
The other point is that when you have a problem with shapes, the way to debug it is to print the shapes of everything. Print the shape of W1 before, the shape of dW1 before and then the shape of W1 after the update. That should be a pretty big clue as to what is going on.
Oh, no, you can see the bug in the code you showed: you have a “copy/paste” error. Look at the line that is supposed to be updating W2: it actually updates W1, right?
Printing the shapes would have also given that clue: the shape of W1 would be the shape of W2.
yes that it is, thanks Paul!