W2 assignment 2 Exercise 2 wrong sequential output shape

I’m getting the following test fail in :

Expected value 

 ['Sequential', (None, 160, 160, 3), 0] 

 does not match the input value: 

 ['Sequential', (None, None, 160, None), 0]

which is rather strange and I can not figure out what’s wrong. The complte summary of my implementation is:

Model: "functional_30"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_88 (InputLayer)        [(None, 160, 160, 3)]     0         
_________________________________________________________________
sequential_3 (Sequential)    (None, None, 160, None)   0         
_________________________________________________________________
tf_op_layer_RealDiv_26 (Tens [(None, 160, 160, 3)]     0         
_________________________________________________________________
tf_op_layer_Sub_26 (TensorFl [(None, 160, 160, 3)]     0         
_________________________________________________________________
mobilenetv2_1.00_160 (Functi (None, 5, 5, 1280)        2257984   
_________________________________________________________________
global_average_pooling2d_30  (None, 1280)              0         
_________________________________________________________________
dropout_24 (Dropout)         (None, 1280)              0         
_________________________________________________________________
dense_15 (Dense)             (None, 1)                 1281      
=================================================================
Total params: 2,259,265
Trainable params: 1,281
Non-trainable params: 2,257,984
_________________________________________________________________
None

So all the rest of the lines are OK and I can even train the model, finish the rest of the assignment, and get some meaningul results.

I guess the problem should be in some of the lines :

# create the input layer (Same as the imageNetv2 input size)
# apply data augmentation to the inputs
# data preprocessing using the same weights the model was trained on

but when I print the dimensions I always get the right one: [(None, 160, 160, 3)] . So I can’t even figure out what stage of the network “sequential_3 (Sequential)” is refering to. If it is the preprocessing set, I am just applying the pre_processing function defined above to x.

1 Like

Please click my name and message your notebook as an attachment.

1 Like

Thank you for your fast reply. I wanted to rerun the whole assignment before sending it to you and now it workes smoothly. I bet that the issue was that maybe I ran some previous cell twice changing the output. Sorry for the trouble.

1 Like

For anyone else with the same problem.
I had the same problem.
I did “Kernel > Restart & Clear Outputs” and ran it from the first cell and it worked fine.

3 Likes

Thank you!