Cell #8. Can't compile the student's code. Error: NameError("name 'value' is not defined")

I dont know what is the problem here according to the error code the variable value is not defined which is defined and can be clearly seen in the photo also EVERY single test in the notebook is successful I am really confused , for 1 hour I don’t know what is the problem

Update: I reverted the notebook to a checkpoint and did all my work again and yet the same problem this is really frustrating, help will be so much appreciated

That’s a very odd error. I have not seen it before.

I just tested the grader with my notebook, it seems to work correctly.


I have the same issue. When I run locally, all cells are compiled. But auto-grader still fails. Have no idea what can be the reason…

Ah actually I figured out the reason. I used kernel_initializer=tf.keras.initializers.he_normal while auto-grader expected me to do: kernel_initializer=‘he_normal’

Hi TMosh,

I also got similar error in the grader. I passed 5 out of 6 (except Ex 4) which should give me a pass. I also did the assignment outside in a Jupyter Notebook and downloaded the file in ipynb format. How do I send it to your review?


Solved all 6 with “All tests passed”. When I submitted there was no error. Is it possible that if we skip any one exercise in the middle, we get “can’t compile the student’s code” error?

Yes, usually the grader will not accept a partially-completed notebook.

I thought get > 80% and pass the test. But the machine wouldn’t let that happen. Great. Useful for future exercises.


You only pass the grader if your code doesn’t cause it to crash. Leaving part of the assignment incomplete (with the ‘None’ statements remaining) causes runtime errors due to incorrect data types.

Once you get all the code to run without crashing, then the 80% threshold applies.

I also ran the assignment outside the coursera environment in a Jupyter notebook and completed without error. How do I submit the *.ipynb file for assessment which I downloaded from the Jupyter Notebook?

You have to upload the ipynb file back into Coursera Labs.
Be sure you do not change its original file name.

Thanks. That’s easy. I will try that next time around.


I am getting the same error. please resolve the issue. thanks

i also encountered the same issue. I replaced the original lab file any solution to get back the original lan file?

To get a fresh copy of your lab assignment, check this.

Hey all! Got a similar error message but the code it refers to is one provided to run and not edit (couldn’t edit if I wanted to). Any way for a manual grader to step in with these issues?

That cell might be a test cell. Check the cell above it. For example, if the grader refers to cell # 5, check the code of cell # 4 or something.