3.2 Building Sequential and Functional Models with Keras
Keras offers two primary approaches for constructing neural network models: the Sequential API and the Functional API. The Sequential API provides a straightforward method for building models by stacking layers in a linear sequence.
This approach is ideal for simple, feed-forward architectures where each layer has a single input tensor and a single output tensor. On the other hand, the Functional API offers greater flexibility and power, enabling the creation of more complex model architectures.
With the Functional API, developers can design models with multiple inputs and outputs, implement shared layers, and construct advanced structures such as residual networks or models with branching ...