C1- W4 Ex. 5 L_model_forward

I recieve this error and don’t know how to solve it. I would love to get some help.

linear_cache should be initialized for both cases relu and sigmoid. Please check your notebook to find which path(s) is missing the right code.

Take a look at the logic in linear_activation_forward: you are not taking either of the cases there, so how could that happen? The value you passed for the activation argument does not match either of the choices, right? You are passing an object reference to the function, but the logic is looking for the string name of the function. That will not end well, as we see :scream_cat:

I didn’t notice that. Thank you for your answers! :blush:

But please note that I’m making two levels of point there: in addition to pointing out what the problem was, I’m also making the “meta” point about how you could have figured that out on your own. It’s a standard thing in debugging that the actual mistake may not be in the function that throws the error: it may well be that it’s higher up the call stack. But the point is you have to start your analysis at the actual point of the error. What does it actually mean? How could that happen? Then work backwards one step at a time …

This is really helpful, also for future bugs. Noted that :+1: