I’m just filling the code between "### START CODE HERE ### " and "### END CODE HERE ### ". After the “# UNQ_C2 # GRADED CELL: Sequential model” goes the cell with “model.summary()”. Don’t think I could add it accidentally. I don’t know how to clean all my changes and start from scratch, so can’t check if this line was there from the start.
# UNQ_C2
# GRADED CELL: Sequential model
tf.random.set_seed(1234) # for consistent results
model = Sequential(
[
### START CODE HERE ###
# My code here
### END CODE HERE ###
], name = "my_model"
)
Then this cell: model.summary()
Update: I’ve started from scratch and the above is how it looks from the start.
@slava.t Have you tried adding a tf.keras.Input layer to your model? or adding an input_shape argument to the first layer of the model?
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.
It’s kind of confusing, that the previous labs say that this layer is optional and in this lab this layer is necessary to prevent an error in the next cell. I somehow missed the line “We will include that here to illuminate some model sizing.”
This worked to resolve the error, but I agree that this step was not clear at all. It also required adding “Input” to the import from Keras models line in the first executable cell in the notebook.
alternatively one can add the named argument “input_shape=(400,)” to the first layer of the model instead of adding “Input” to the import from Keras models line in the first executable cell in the notebook.
Hard-coding the size of the input shape is usually not a good idea. But it’s done in this part of the assignment to force the model.summary() function to have some information to display.
It’s weakly mentioned in this text from the notebook: