How keras-team/keras works
Keras 3 is a multi-backend deep-learning framework. A typical user builds a model from inputs, layers and operations, configures a loss, metrics and optimizer, then trains or predicts; models can also be saved or exported. The repository tree and README establish these capabilities, while excerpts show selected layer, operation and backend internals. Several domain branches are represented at their documented subsystem directories because their implementations were not sampled; dashed edges mark relationships not verified in the excerpts.
Main entry points: __init__.py Public API · models Model construction · trainer.py Training and prediction · ops Keras operations
Components 20
Modeling and tensors
- Public API
keras/api/__init__.py - Model construction
keras/src/models - Layers
keras/src/layers/layer.py - Attention layers
keras/src/layers/attention/multi_head_attention.py - Symbolic tensors
keras/src/backend/common/keras_tensor.py - Keras operations
keras/src/ops - Application models
keras/src/applications
Training and data
- Datasets and preprocessing
keras/src/datasets - Training and prediction
keras/src/trainers/trainer.py - Losses and metrics
keras/src/losses/losses.py - Optimizers
keras/src/optimizers - Training callbacks
keras/src/callbacks
Backend runtime
- Backend dispatch
keras/src/backend/__init__.py - Backend implementations
keras/src/backend - Distribution
keras/src/distribution
Model lifecycle
- Model saving
keras/src/saving - Model export
keras/src/export
Other components
- Keras user
- Backend frameworks
- Remote storage
Connections 21
- Keras user → Public API: uses
README.md - Public API → Model construction: exposes
- Public API → Layers: exposes
keras/api/__init__.py - Public API → Keras operations: exposes
- Public API → Application models: exposes
- Model construction → Symbolic tensors: builds graphs
- Layers → Keras operations: computes with
keras/src/layers/layer.py - Attention layers → Layers: extends
- Attention layers → Keras operations: uses
- Keras operations → Backend dispatch: dispatches operations
keras/src/ops/numpy.py - Backend dispatch → Backend implementations: selects backend
keras/src/backend/__init__.py - Backend implementations → Backend frameworks: runs on
README.md - Keras user → Datasets and preprocessing: provides data
- Model construction → Training and prediction: trains or predicts
- Training and prediction → Losses and metrics: evaluates
- Training and prediction → Optimizers: updates weights
- Training and prediction → Training callbacks: uses callbacks
- Training and prediction → Distribution: scales training
- Model construction → Model saving: saves model
keras/src/saving/serialization_lib.py - Model construction → Model export: exports model
- Model saving → Remote storage: reads or writes
README.md