CNN course Week 2 Assigment 1

Even though all cells show Tests passed, grader gives this error:

Cell #3. Can’t compile the student’s code. Error: AttributeError(“‘NoneType’ object has no attribute ‘numpy’”)
Traceback (most recent call last):
File “/home/www/app/grading/”, line 112, in handle_solution_errors
yield {}
File “/home/www/app/grading/”, line 393, in _grade
context =
File “/home/www/app/grading/submission/”, line 195, in run
return list(self._code_items.values())[cell_num - 1].run()
File “/home/www/app/grading/submission/”, line 54, in run
return import_module(self.import_statement, items)
File “/usr/local/lib/python3.8/importlib/”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 843, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/tmp/student_solution_cells/”, line 19, in
A3np = A3.numpy()
AttributeError: ‘NoneType’ object has no attribute ‘numpy’

Is it a problem with my code or grader problem?

It probably your coding error. Whats this A3.numpy() doing? I haven’t seen such method before, there is a numpy library but I haven’t seen it call ed before like this!

I solved it with Updating the Kernel. Written Code was correct but needed to update the Notebook Environment

If A3 is a TF Eager Tensor, then that converts it into a numpy array.

Note that code was given as part of one of the non-editable test cells in the Residual Networks notebook. But if your code threw that error, it means there is something wrong with the return value from your identity_block function. Somehow that works in the notebook, but does not work correctly in the grader context. If restarting the kernel helped, that probably means your execution state is not consistent. If you edit a cell, then you have to execute it with “Shift-Enter” for the new code to be included in the runtime image. It’s also not clear whether the grader always does a “Save” for you automatically. In the earlier DLS courses I think it does, but in C4 and beyond I don’t think that is always true.

1 Like

Thanks for clarifying @paulinpaloalto I really thought that was a mistake.