Getting Error: 'InputLayer' object has no attribute 'output_shape'

In the image segmentation assignment, after defining the conv_block function when I am trying to give some input and get the output summary of the model then I am getting this error: ‘InputLayer’ object has no attribute ‘output_shape’


this is the code I am using and I am trying to run the notebook locally on my machine

There’s no need for you to create an InputLayer inside conv_block function. Please make use of the function parameter inputs to code the function.

Please click my name and message the function code as text.

Don’t forget to remove code from the post as posting code in public could get your account suspended.
It’s okay to leave stacktraces in public though.

thanks for telling!

You’re welcome. The code passes the tests.

Are you running the notebook inside the coursera lab environment?
Here’s the tensorflow and keras versions in the coursera juputer lab environment:
image

If you’re using the same package versions, please refresh your workspace after removing all files in the workspace and confirm the status.

I am running the notebook locally on my machine. I have the latest versions of TensorFlow and Keras installed, but when I try to install TensorFlow version 2.9.1, it says “no matching distribution.” Does this mean I have to downgrade the Python version as well?

That is a problem. The Coursera Labs notebooks don’t use the latest versions of these packages.

1 Like

When in doubt, use coursera lab environment as reference to create a local workspace.

image

1 Like

yeah will keep in mind next time. Thank you!

thank a ton for the help!