0
votes

Keras documentation includes this bit on the section of Conv1D

When using this layer as the first layer in a model, provide an input_shape argument (tuple of integers or None, e.g. (10, 128) for sequences of 10 vectors of 128-dimensional vectors, or (None, 128) for variable-length sequences of 128-dimensional vectors.

I am wondering why this is required and why it is not required to provide the inputs shape elsewhere in the model.

1

1 Answers

1
votes

It's about how layers are connected. The layers after the first layer are chained so their input shapes are equal to the output shape of the previous layer in a sequential model:

model.layers[i].input_shape == model.layers[i-1].output_shape

But what about the very first layer? Since the model cannot infer what the shape should be, it asks you to provide it. After the first input all the shapes can be calculated.