Week 1, Assignment 2, Exercise 1 - HappyModel

Hi There,

Am really struggling with the keras sequential model setup, please can someone share some detailed tips?

Thanks,
Josh

Please do not post your code on the forums. That breaks the course Honor Code. Please edit your message and remove the code.

In the Sequential model, you’re creating a list of layers within the square brackets. So you need to separate each item with a comma.

Thank you, code has now been removed apologies.

So in the square brackets it is just a list seperated by columns of each layer function preceded by “tfl.”?

Where does the input_shape come in?

Thanks

I also am trying to understand this

Ah I got it for input look at tf.keras.Input()

1 Like

@TMosh - please can you share some further points on this? I have setup each of the layers as “tfl.function” separated by the commas. Do any of the layers need to define objects explicitly used in later layers or not?

In the Sequential model, you’re defining the sequence of layers that are in your model. You only have to specify the shapes that each layer expects, and any specific arguments that configure the layer (filter sizes, padding, etc). You don’t specify any of the actual data.

Later on, when the model is invoked, the input data is passed to the model, and the model passes the data through each layer in sequence automatically. The output results emerge at the end and are returned.

@jlecornu Try adding “input_shape” parameter in ZeroPadding2D which is a tuple representing the input_shape.

1 Like