Week 01 Programming Assignment 2

For the first block, where we are creating a sequential model for the first time, the code “summary(happy_model)” throws the following error: “AttributeError: The layer has never been called and thus has no defined output shape.” On researching a bit, I found that the error is because we haven’t given an input to the model. How to resolve this error?

Hi @RohanSWilkho
Welcome to the Community!

The Function ZeroPadding2D has an attribute was not set with this shape input shape of 64 x 64 x 3, You are receiving this error because Encoder layer isn’t complete that because the input shape is generally the shape of the input data provided to the Keras model while training . The model cannot know the shape of the training data. The shape of other tensors(layers) is computed automatically.

Cheers,
Abdelrahman

1 Like

The introduction to the Sequential API that they give in the notebook is pretty minimal. It might be a good idea to start by reading this thread created by a fellow student which has a much nicer introduction to the Sequential and Functional APIs.

2 Likes