Test case 2 hidden not defined


In the DLS course 1 week 4 programming assignment I get this error message:

NameError Traceback (most recent call last)
----> 1 t_X, t_parameters = L_model_forward_test_case_2hidden()
2 t_AL, t_caches = L_model_forward(t_X, t_parameters)
4 print("AL = " + str(t_AL))

NameError: name ‘L_model_forward_test_case_2hidden’ is not defined

I was wondering if anyone else has had this problem and might know where to look to fix it? I’ve read everything I could on here regarding the other related errors in this section including using the correct layer once I exit the for loop. This error has come up once I thought I resolved these issues by correcting my indentations so that I am using the ‘A’ that comes out of the for loop in the relu activation for the sigmoid activation.


Hello @zac_builta,

The name ‘L_model_forward_test_case_2hidden’ is defined by running the following line of code in the first code cell of the notebook:

from testCases import *

So, my suggestion would be to run all the code cells again from top to bottom to ensure all names are defined in proper order. Note that every time we re-open an assignment, we need to re-run each and every code cell from the the very top.


Tests passed! Thank you for your assistance. Much appreciated.

You are welcome @zac_builta!

That’s great! Note that this issue (“included function not defined”) is explained on the DLS FAQ Thread. Since this was news to you, it would be a good idea to scan the list of topics covered there.

1 Like

Thank you. I didn’t realize that instruction applied in this case but in hindsight I will not re-run all code when in doubt.