Adding tf.keras.Input in keras.Sequential()


In week 2’s assignment we had to manually enter the Dense layers into the Sequential command in the format:
Sequential([tf.keras.Input(shape=(400,)), Dense(25, activation=‘relu’), …]).
My question is if we do not specify the input shape with tf.keras.Input then the neural net work is created but on the jupyter notebook it does not work like that, why? And is this the only way in which we can specify the input shaps? Can we for example add it later to the model object?


Hi @Tadashi_Matsumoto,
The “Specifying the input shape in advance” section in the Keras Sequential model documentation has a good general explanation with examples.

1 Like