Open AshwinJay101 opened 1 year ago
@AshwinJay101,
When defining a network in Keras, the first layer added needs to have input_shape added and you should specify input shape for the first layer of the model.
Could you please refer the docs here: https://keras.io/getting-started/sequential-model-guide/#specifying-the-input-shape
Also for the MNIST, you should have something like input_shape=(28,28,1)
There is a example here for the reference: https://www.kaggle.com/adityaecdrid/mnist-with-keras-for-beginners-99457
This still does not solve the issue @tilakrayal
The subclass model actually has the output defined if you look at my code. Its after saving and loading that it does not retain those attributes
I tried adding input_shape and still get the same error
File "/usr/local/lib/python3.8/site-packages/keras/engine/base_layer.py", line 2096, in output
raise AttributeError('Layer ' + self.name + ' has no inbound nodes.')
AttributeError: Layer autoencoder has no inbound nodes.
Also apparently after loading I need to add this for it to work
vae2(inputs)
print(f"Loaded Model: {vae2.output}")
This is not required for functional models but only for subclass models. Would still love for it to be supported by default for subclass models
This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.
Just commenting so that it doesnt get closed. I had provided the response
@sachinprasadhs, I was able to reproduce the issue on tensorflow v2.11 and tf-nightly. Kindly find the gist of it here.
System information.
Describe the problem.
If you notice when I load from a subclass model, I am not getting the shape of the output which was present in the original model
Describe the current behavior.
I am getting the following error
Describe the expected behavior.
The expected behaviour would be that the model would show the output as seen in the original model
Contributing.
Standalone code to reproduce the issue.