Layers are the atoms. Dense, Conv2D, MultiHeadAttention, LayerNormalization, Dropout, plus the preprocessing layers that bake normalization and tokenization *into the model* so deployment carries them along. This track is the catalog of what Keras gives you out of the box.
What a layer actually is
A Keras layer is a callable object that owns two things: a chunk of state (its trainable weights) and a transformation (its call method). You compose them like Lego — the output tensor of one becomes the input tensor of the next — and Keras tracks the weights, the shapes, and the gradient path for you. Master the handful of core layers below and you can read the architecture of almost any published model.
| Layer | Purpose | Key Args |
|---|---|---|
Dense | Fully connected | units, activation |
Embedding | Integer → dense vector lookup | input_dim, output_dim, mask_zero |
Masking | Marks timesteps as padding | mask_value=0.0 |
Lambda | Wraps arbitrary operation | function |
Input | Placeholder tensor | shape, dtype, name |
EinsumDense | Generalized dense via einsum | equation, output_shape |
Embedding: the one that trips people up
Most core layers are obvious from their name. Embedding is the exception worth pausing on. It's a learned lookup table: integer token IDs go in, dense float vectors come out, and the table itself is trained by gradient descent alongside the rest of the model. Two args do all the work — input_dim is your vocabulary size (how many distinct tokens exist) and output_dim is the width of each vector. Set mask_zero=True and token 0 is treated as padding, so downstream recurrent and attention layers know to ignore it.