Week1 [Convolution Model Application] Error message The layer has never been called and thus has no defined output shape

Getting an error message ‘The layer has never been called and thus has no defined output shape’ while trying to print the layers in the sequential model.


Hi Souptik,

This error message indicates that something went wrong while building a layer in the model. This may be because you did not provide all required parameters, such as input_shape for the ZeroPadding2D layer.

Unfortunately, the tensorflow documentation of tf.keras.layers.ZeroPadding2D does not include an example in which this parameter is used, but it can be included as a parameter.

Good luck. Let me know if it worked out.


Ok , I added input layer in the sequential model and it worked.


Great! Good luck with the rest of the course and don’t hesitate to ask if you run into issues.

Oh, and could you please remove the piece of code from your reply? Thanks!

Had the same problem and it worked when I added the input_shape parameter.
The TensorFlow official documentation does not even mention there is this parameter. So I wonder if there is a more complete Tensorflow documentation? Or am I missing something?

1 Like

Hi kleber,

Your google is as good as mine, but I found this, which forms part of this extensive manual, which in turn forms part of this huge overview of APIs. Enjoy!

1 Like

Thanks reinoudbosch. didn’t mean to be a lazy question. now i understand what **kwargs means ( that there are many other unespecified number of other keyworded arguments), the documentation made sense to me. still a newbie to python, thought there were only 3 kw params.
Thanks again

You’re welcome kleber. I didn’t mean to imply that you were lazy, just that you may be able to find something else, better, or clearer than what I found! Good luck with the rest of the course.

1 Like

Hi I am not getting how to do it, please help

Hi Aman_Kothari,

Please do not share coding solutions!