How to Use the Keras Functional API for Deep Learning

Last Updated on May 28, 2020

The Keras Python library makes creating deep learning models fast and easy.

The sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs.

The functional API in Keras is an alternate way of creating models that offers a lot more flexibility, including creating more complex models.

In this tutorial, you will discover how to use the more flexible functional API in Keras to define deep learning models.

After completing this tutorial, you will know:

  • The difference between the Sequential and Functional APIs.
  • How to define simple Multilayer Perceptron, Convolutional Neural Network, and Recurrent Neural Network models using the functional API.
  • How to define more complex models with shared layers and multiple inputs and outputs.

Kick-start your project with my new book Deep Learning With Python, including step-by-step tutorials and the Python source code files for all examples.

Let’s get started.

  • Update Nov/2017: Added note about hanging dimension for input layers.
  • Update Nov/2018: Added missing flatten layer for CNN, thanks Konstantin.
  • Update Nov/2018: Added description of the functional API
    To finish reading, please visit source site