Course 1 Week 4 Error

I get the following error trying to test the L_model_forward function. All previous functions work fine.

Never mind. Fixed it. The problem was I forgot to provide the activation as a string (quotations).

Have a more careful look at the logic in linear_activation_forward to understand what it expects for the value of the activation parameter. You are passing the wrong value, which is why neither of the branches get taken and linear_cache does not get assigned a value.

1 Like

Great! Glad to hear that you found the error under your own power. You were passing an object reference to the function instead of the string name. Of course you could argue that doing it your way is more ‘pythonic’: you can actually pass a function as a parameter to another function. Then they would not have needed any logic to check the value of the activation parameter: they could have just called the function. But maybe they were trying to avoid using more sophisticated python constructs like that when they created these courses.

1 Like