The Sequential API allows you to create simple models layer by layer in a step-by-step fashion. It's suitable for a plain stack of layers where each layer has exactly one input tensor and one output tensor.
On the other hand, the Functional API is more flexible and allows for the creation of complex models with shared layers, multiple inputs, and multiple outputs. It's useful when you need more control over the connections between layers.
from keras.layers import Input, Dense
from keras.models import Model
input_layer = Input(shape=(input_shape,))
hidden_layer = Dense(units=... , activation=...)(input_layer)
output_layer = Dense(units=output_shape, activation='softmax')(hidden_layer)
model = Model(inputs=input_layer, outputs=output_layer)
#deeplearning #machinelearning #tensorflow