C1, Week4, Excercise4 'l_model_forward' has issue with 'linear_cache'

I’m getting an error that states that the ‘linear_cache’ is referenced before the assignment.

The issue seems to be in the function: linear_activation_forward, but that did pass all the tests and it does the assignment of the values for (A,W,b) into the linear cache and then into cache.
I’m out of ideas about what can be wrong with my code in ‘l_model_forward’ which causes this issue in the previous function.

1 Like

A perfectly correct function can still throw errors if you pass it incorrect arguments. How can you get to that line without setting linear_ cache? It means you didn’t take either of the conditional branches, right? So what you passed as the activation argument did not match the two possible choices. Note that relu is not the same thing as "relu": the first is an object reference to a function and the latter is a string giving the name of a function. Which is required in this case? Or did you pass a string name, but misspell it?

Thank you paulinpaloalto, I used the wrong statement to set the activation function. Corrected it and it works now.

1 Like