Dimension of output in Dense layer Keras I have the sample following model
from tensorflow.keras import models
from tensorflow.keras import layers
sample_model = models.Sequential()
sample_model.add(layers.Dense(32, input_shape=(4,)))
sample_model.add(layers.Dense(16, input_shape = (44,)))

sample_model.compile(loss=&quot;binary_crossentropy&quot;, optimizer=&quot;adam&quot;, metrics = [&quot;accuracy&quot;])

IP for the model:
sam_x = np.random.rand(10,4)
sam_y = np.array([0,1,1,0,1,0,0,1,0,1,])
sample_model.fit(sam_x,sam_y)

The confusion is the fit should have thrown an error of shape mismatch as the input_shape for the 2nd Dense Layer is given as (None,44) but the output for the 1st Dense Layer (which is the input of the 2nd Dense Layer) will be of shape (None,32). But it ran successfully.
I dont understand why there was no error. Any clarifications will be helpful
The answer can be found by just printing
sample_model.summary()

giving
Model: &quot;sequential&quot;
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
dense (Dense)                (None, 32)                160       
_________________________________________________________________
dense_1 (Dense)              (None, 16)                528       
=================================================================
Total params: 688
Trainable params: 688
Non-trainable params: 0
_________________________________________________________________

Indeed, the input_shape argument in a layer that is not the first one is ignored in a Sequential model.