The week 2 practice lab

in the week 2 practice lab’ im having a hard time understanding why do i have to specify my input size in the tenzorfflow format, in the why showed in the snippet below?
thecode dosent seem to work without that line here but in other practise labs (like week 3’s lab) it does…

also, what is the line that contains the moels name (here its name = “my_model”) used for? is it necessary?



It is needed in this instance because in the code cell after this model.summary() is called.
Without information about the input TensorFlow has no way to know what the Shape of the input data is going to look like and cannot create the model until it gets the first piece of data and infers the shape from there.

See the Keras Sequential Documentation by Francois Chollet The Sequential model

Naming is for identification and tools such as Tensorboard can show model names in their displays.

1 Like