C4 Week1 happymodel


I really don’t know what to do with the happymodel(). I have googled a lot and tried a lot of things but none was working. All of them were stuck in either ZeroPadding2D or Conv2D. It kept giving the same error: invalid syntax. I’m pretty sure all my arguments are correct. Could anyone give a hint? I will appreciate it a lot.

Refer the second code block in The Sequential model. You create the Sequential model by passing the layers as a list to the tf.keras.Sequential class. This is one of the methods to create a model, refer the same link for different methods.

Hi, thanks a lot! The thing is, this is actually one of the sites I referred to. Could you help me check which part goes wrong in the following codes? It gives an invalid syntax error.

tf.keras.Input(shape = (64,64,3))

Edit: the following code also gives an error (tested by commenting out the line above)

tfl.Conv2D(32, 7, strides = 1, activation=‘relu’)


Hi Roland,

Thanks a lot! I just solved the problem. For future reference: make sure you added a comma at the end of each line, or it will not compile.


If you are using the Sequential model, then you don’t have to add the tf.keras.Input layer to it (its used in the Function API later in the assignment though), you can just pass in the shape of the input as an argument to the tfl.ZeroPadding2D layer (argument is input_shape=)

In the Conv2D layer, you haven’t passed the filter size yet, the argument is kernel_size=


Roland, thanks for posting your tips. It’s very helpful to the community.