Week 2 Lab 1 W2A1 Residual_Networks.ipynb

Everything seems ok with my code (accuracy of the deep res net is 97%), but the test

from outputs import ResNet50_summary
model = ResNet50(input_shape = (64, 64, 3), classes = 6)
comparator(summary(model), ResNet50_summary)

generates an Error Message (which probably has something to do with “naming” the layers??):


 Expected value 

 ['Add', (None, 15, 15, 256), 0] 

 does not match the input value: 

 ['TensorFlowOpLayer', [(None, 15, 15, 256)], 0]

How do I fix this error?

Sorry for this Topic.

Before closing the window I went through the complete notebook again and found my mistake

I wrote X + X_shortcut instead of

X = Add()([X, X_shortcut])

Somehow the operator + worked fine, but the test itself required Add!

It’s great that you were able to find the solution based on your own analysis. Thanks for confirming!

You’re right that this is really a limitation of the comparator method they are using to check the model. Your original code may well be correct, but the generic TensorFlowOpLayer would also have shown up if you had used “-” or “*” instead of “+” there. So they require you to use an explicit Add layer function.