Functional

The functional API enables you to define more complex models, such as multi-output models, directed acyclic graphs, or models with shared layers. To create a model with the functional API compose a set of input and output layers then pass them to the keras_model() function:

Custom

Custom models enable you to implement custom forward-pass logic (e.g. to encapsulate the logic associated with constructuing various types of models). See the article on Writing Custom Keras Models for additional documentation, including an example that demonstrates creating a custom model that encapsulates a simple multi-layer-perceptron model with optional dropout and batch normalization layers.

Properties

All models share the following properties:

model$layers — A flattened list of the layers comprising the model graph.

model$inputs — List of input tensors.

model$outputs — List of output tensors.

Functions

These functions enable you to create, train, evaluate, persist, and generate predictions with models: