Gets the following error after assignment submission

Course :

Practice Lab: Neural Networks for Binary Classification in machine learning specialization.

Error Detail :

Cell #9. Can’t compile the student’s code. Error: AssertionError(‘Wrong number of units in layer 0. Expected [None, 25] but got [None, 64]’)
Traceback (most recent call last):
File “/home/www/app/grading/exceptions.py”, line 112, in handle_solution_errors
yield {}
File “/home/www/app/grading/abstract.py”, line 393, in _grade
context = compiled_code.run(cell_index=cell.index)
File “/home/www/app/grading/submission/compiled_code.py”, line 195, in run
return list(self._code_items.values())[cell_num - 1].run()
File “/home/www/app/grading/submission/compiled_code.py”, line 54, in run
return import_module(self.import_statement, items)
File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/tmp/student_solution_cells/cell_9.py”, line 14, in
test_c1(model)
File “/tmp/public_tests.py”, line 21, in test_c1
f"Wrong number of units in layer {i}. Expected {expected[i][1]} but got {layer.output.shape.as_list()}"
AssertionError: Wrong number of units in layer 0. Expected [None, 25] but got [None, 64]

I am not sure which course this is in the ML specialization but you posted under general discussions; you need to post in the respective specialization and course!

This is the error you are getting: Cell #9. Can’t compile the student’s code. Error: AssertionError(‘Wrong number of units in layer 0. Expected [None, 25] but got [None, 64]’)

This means your input to layer zero of your model is not correct; check what size you are inputting to layer 0 of the model!

1 Like

I’m going to guess this is from C2 W1, where the full notebook title is:
Practice Lab: Neural Networks for Handwritten Digit Recognition, Binary

That’s just based on the existence of the line of code test_c1(model).

So the error is in the cell that creates “model”, that’s Exercise 1 at UNQ_C1 (create a Sequential model).

yes exactly . you are right :slight_smile: . Would you please help me to find the solution for it or how can i resolve this issue .

Use the instructions in Section 2.3 of the notebook to add three “Dense()” statements, where inside the parenthesis you put the correct number of units for that layer, and an argument for the activation type.

Use the “Click for hints” link below the ‘Expected Output’ to see exactly how to write this code.

2 Likes

thanks for your help and time , would you please tell is there any way to reset the lab or get the new lab from the start ?

Use the “File” menu to delete or rename your current notebook.
Then use Lab Help (the ? icon) to “Get Latest Version”.