In this case, you should start your model by passing an Input object to your model, so that it knows its input shape from the start:

Note that the Input object is not displayed as part of model.layers, since it isn't a layer:
model.layers
A simple alternative is to just pass an input_shape argument to your first layer:




Models built with a predefined input shape like this always have weights (even before seeing any data) and always have a defined output shape.
In general, it's a recommended best practice to always specify the input shape of a Sequential model in advance if you know what it is.


A common debugging workflow: add() + summary()
A common debugging workflow: add() + summary()
When building a new Sequential architecture, it's useful to incrementally stack layers with add() and frequently print model summaries