Syntax for keras.Sequential([])

Can someone please provide a reference to learn how to instantiate a tf.keras.Sequential object? I’ve looked at the keras documentation and have found it woefully inadequate! It’s some of the worst documentation that I’ve ever seen!

The only examples that I’ve seen on the web are of the following form:
model = keras.Sequential() followed by a bunch of calls to the keras .add() method.

The template for the happyModel() function seems to want a list.

Also, how can I pass a parameter to ZeroPadding2D to specify the input shape of (64, 64, 3)?

Can you please provide a hint on the correct syntax? If not, can I assemble the model object by making 7 calls to the add method?

Thanks in advance.

1 Like

I believe I figured out the syntax. The main stumbling block for me was the “(x)” in most of the examples I saw on the web. See the following:

I was able to get this to work when I ignored the “(x)” portion of the above example. I haven’t the slightest idea of its purpose, and the documentation DEFINITELY does not provide any details!

The (data) portion is used in the Functional model - that’s how you pass data to the layer.

In the Sequential model, you’re just creating a list of layers. When you want to run the model, you only pass it the input data, and the model automatically passes the data between the layers sequentially, and out pops the results at the end.