All the layers mentioned in the previous section need to be added to the model we created earlier. In the following sections, we describe how to add the layers using the functional API and the sequential API.
Adding Layers to the Keras Model
Sequential API to add layers to the Keras model
In the sequential API, you can create layers by instantiating an object of one of the layer types given in the preceding sections. The created layers are then added to the model using the model.add() function. As an example, we will create a model and then add two layers to it:
model = Sequential()
model.add(Dense(10, input_shape=(256,))
model.add(Activation('tanh'))
model.add(Dense(10))
model.add(Activation('softmax'))
...