C4 W1 A2: Convolution_model_Application- error

Hi There,

I hope you’re doing well. I am trying work on def happyModel() and I am getting below error message. Not sure why mistake I am making. Could some one please help me to resolve this issue. Please let me know if you need any other details to analyze this issue.


AttributeError Traceback (most recent call last)
48 happy_model = happyModel()
—> 49 summary(happy_model)

~/work/release/W1A2/test_utils.py in summary(model)
34 result =
35 for layer in model.layers:
—> 36 descriptors = [layer.class.name, layer.output_shape, layer.count_params()]
37 if (type(layer) == Conv2D):
38 descriptors.append(layer.padding)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in output_shape(self)
2177 “”"
2178 if not self._inbound_nodes:
→ 2179 raise AttributeError('The layer has never been called ’
2180 ‘and thus has no defined output shape.’)
2181 all_output_shapes = set(

AttributeError: The layer has never been called and thus has no defined output shape.


Did you Run the cell that contains the happyModel() definition?

I’m not sure what type of error would cause that particular message, but my suggestion would be to spend 15 or 20 minutes studying this thread about the Keras Sequential and Functional models and then take another look at your code based on what you will learn from that thread. We’re diving into pretty deep waters here and the introduction they give you in the notebook is not as complete as one might hope. That thread explains things in a more accessible and actionable way.

Yes I did ran all the cells before the happyModel().

Thanks for sharing this information. I will go through it and let me see if I can resolve this issue.