keras mixing Sequential and functional API code example

Example: keras declare functional model

# The Keras functional API is a lot more flexible than the Sequential API
from keras.models import Model
from keras.layers import Input
from keras.layers import Dense

# Declared the input layer with input shape 2
visible = Input(shape=(2,))
# Fed the output of the input layer into a hidden layer of size 2
hidden = Dense(2)(visible)
# Defined an actual model out of the above with an output being the same shape as the above layer and input being the size as the input layer
model = Model(inputs=visible, outputs=hidden)