Course 1. Week 4. First coding assignment. Exercise 9 - L_model_backward problem


dA0 = [[ 0. -0.52257901]
[ 0. 0.3269206 ]
dA1 = [[ 0.12913162 0.44014127]
[-0.14175655 -0.48317296]
[ 0.01663708 0.05670698]]
dW1 = [[-0.41010002 -0.07807203 -0.13798444 -0.10502167]
[ 0. 0. 0. 0. ]
[-0.05283652 -0.01005865 -0.01777766 -0.0135308 ]]
dW2 = [[0.14279644 0.2122625 0.35110662]]
db1 = [[0.22007063]
[0. ]
db2 = [[-0.277999]]
Error: Wrong output for variable dA1.
Error: Wrong output for variable dW2.
Error: Wrong output for variable db2.
Error: Wrong output for variable dA0.
Error: Wrong output for variable dW1.
Error: Wrong output for variable db1.
2 Tests passed
1 Tests failed

I am a bit stumped as to why this is occurring. I managed to pass the gradients into Exercise 10 and I passed all of the tests for that exercise. I am stumped. Please help.

Thank you!

Notice that a lot of your values have the correct absolute value, but the opposite sign. I think you should check your initial computation of dAL, which you don’t show. That is input to everything here and the signs there are a potential pitfall. FWIW, I added a print statement to my code to show that value and here’s what I get on that test case:

dAL = [[-0.5590876 1.77465392]]

Also please note we aren’t supposed to leave source code sitting around on the forums or in any other public place, so please edit your initial post to remove that once you have a solution here. Thanks!

Thank you! I apologize. I have removed it and left the output.

1 Like

Great! Thank you for taking care of that! It’s always fine to show output and even exception traces, just not the full source code. It always helps for debugging purposes, but we just don’t want to leave the answers out there. The code you showed looked correct to me FWIW.

Was the - sign on dAL the issue for you? Sorry, I’m assuming that is the case, since you didn’t say anything more about it, but wanted to confirm.


Yes the sign on dAL was the issue, and everything runs smoothly now. Thank you!

Best regards,

1 Like

Thank You so much I was stuck on that for hours