A Sequential model is a Keras model built as a simple linear stack of layers: one input flows through each layer to one output. It is the most approachable model-building API, but it is limited to straightforward stacks rather than branching or graph-like topologies. section 3.6.3 section 7.2
A two-layer Sequential model
library(keras3) model <- keras_model_sequential() |> layer_dense(64, activation = "relu") |> layer_dense(10, activation = "softmax") The same model can be assembled incrementally by appending layers. To inspect shapes while building, declare the input shape first: keras_model_sequential(input_shape = c(3)). section 7.2.1
Keep these construction and debugging details in mind:
- Layers create their weights when first called, or when model$build(input_shape = ...) is used; an unbuilt model has no weights. section 7.2.1
- Choose the Functional API for graph-shaped architectures and model subclassing when you need low-level control; these approaches can still interoperate with Sequential models. section 7.2 section 7.2.4

