I can’t understand where I am going wrong can someone please clear this up
Does this help? Course1 Week4 Exercise9
I did calculate dAL manually tho
It’s not working in EX9 but when I call the same function in EX10 it passes all test cases
In the image you show of the error, we can’t see what the arguments to linear_activation_backward are, but I think that’s where the error is. The grads values on the LHS of the assignment will get created, so they can’t throw that KeyError. There should be no case in which dA0 is the input, right? So that means one of two things:
- Your loop logic is wrong and you’re running the loop one too many times. But they gave that to you, right?
- The index expression for grads in the arguments to that function is incorrect. When you run linear_activation_backward for layer l, the input is dA^{[l]} and the output is dA^{[l-1]}, right? But remember how indexing works in python: it is zero-based. So the l loop index is not actually the layer number: it is one less than the actual layer number.
Have a look at those two issues and see if that sheds any light.
Yeah I was the second one, thanks for the help