Keras Functional API

Learn to create DL models using the functional API of Keras.

A Sequential Keras model consists of a sequence of layers arranged one after the other. We employ the Sequential class to create DL models when each model layer has only one input tensor and one output tensor. Consider, for example, the case when our layers aren’t just stacked on each other but also have multiple inputs or multiple outputs. The Sequential class is unable to build such DL models. Keras provides the functional API to build models that have input or output branches. Let’s explore the details of the functional API of Keras.

Example: Residual block

Consider the following part of a deep neural network architecture where we feed the input xx to a layer ii. The same input skips a few layers, which are learning a network function FF, and adds to the output F(x)F(x) to give us the final output F(x)+xF(x)+x. This block is the well-known residual block, which forms the basis of the seminal network architecture ResNet.

Get hands-on with 1200+ tech skills courses.