WK 1, Ex. 2: NameError when submitting to grade

I am stucked and unable to resolve the following issue: 

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-f33284fd82fe> in <module>
      1 happy_model = happyModel()
      2 # Print a summary for each layer
----> 3 for layer in summary(happy_model):
      4     print(layer)
      5 

NameError: name 'summary' is not defined

In addition, I encounter a similar error while submitting exerise 2: 

Model: "functional_1"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         [(None, 64, 64, 3)]       0         
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 64, 64, 8)         392       
_________________________________________________________________
re_lu_1 (ReLU)               (None, 64, 64, 8)         0         
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 8, 8, 8)           0         
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 8, 8, 16)          528       
_________________________________________________________________
re_lu_2 (ReLU)               (None, 8, 8, 16)          0         
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 2, 2, 16)          0         
_________________________________________________________________
flatten_1 (Flatten)          (None, 64)                0         
_________________________________________________________________
dense_1 (Dense)              (None, 6)                 390       
=================================================================
Total params: 1,310
Trainable params: 1,310
Non-trainable params: 0
_________________________________________________________________
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-15-f1284300b767> in <module>
     15         ['Dense', (None, 6), 390, 'softmax']]
     16 
---> 17 comparator(summary(conv_model), output)

NameError: name 'comparator' is not defined

You have to run all the above cells before this one. And, make sure you do not edit or delete any of the pre-written code/cell.

1 Like

Thanks for the prompt response. I have done so, as well as restarted the kernel and run all cells. However, the issue remains.

That must mean that the problem is that you have accidentally damaged the notebook and removed some code (the second point that Saif made above). E.g. accidentally changed the cell that does the “import” commands to be a Markdown cell instead of a Code cell or something like that.

The best strategy is to get a clean copy of the notebook and start over. You can save your existing work and just carefully copy/paste that in. But be very careful only to modify the “YOUR CODE HERE” sections. Here’s a thread about how to get a clean copy.

4 Likes

Thank you very much; the issue has been resolved.

2 Likes