October 2018
Intermediate to advanced
252 pages
6h 49m
English
Here we can use the Model class to create the model instance, as shown in the following snippet:
from keras.models import Modelfrom keras.layers import Inputfrom keras.layers import Densevisible = Input(shape=(32,))hidden = Dense(32)(visible)model = Model(inputs=visible, outputs=hidden)
We define Model with multiple inputs and outputs:
model = Model(inputs=[a1, a2], outputs=[b1, b2, b3])
In the preceding code, we have multiple layers defined as inputs and outputs. In the next recipe, let's look at how Keras functional APIs can be used for image classification.