The Keras Functional API constructs models by connecting layer operations as a directed graph. It extends beyond Sequential models, which are limited to simple one-input, one-output stacks. section 3.6.3 section 7.2.2
A two-layer Functional model
inputs <- keras_input(shape = c(3), name = "my_input") features <- inputs |> layer_dense(64, activation = "relu") outputs <- features |> layer_dense(10, activation = "softmax") model <- keras_model(inputs = inputs, outputs = outputs, name = "my_functional_model") keras_input() creates a symbolic tensor containing shape and dtype specifications rather than data. Calling layers on it produces new symbolic tensors; keras_model() then binds the declared inputs and outputs. section 7.2.2
Use the API when the model requires graph structure rather than a flat layer sequence:
- Combine Functional models with Sequential components, subclassed layers, or subclassed models. section 7.2.4
Figure 7.1 Progressive disclosure of complexity for model building
Compare Sequential, Functional API, and model subclassing as progressively more flexible model-building workflows. section 7.2


