How d2l-ai/d2l-en works
D2L is an open-source, hands-on deep-learning book: readers study explanations, mathematics, figures, and runnable examples, with framework-specific helper code supporting the examples. Its content ranges from foundations and model training through specialized applications, with mathematics and tooling appendices. The four backend modules provide parallel PyTorch, TensorFlow, JAX, and MXNet APIs. The README documents the integrated book-and-code experience; backend imports and framework dependencies are visible in the excerpts. Most chapter implementations and their specific code links were not sampled, so those relationships are not expanded.
Main entry points: __init__.py Backend selection · torch.py PyTorch helpers · tensorflow.py TensorFlow helpers · jax.py JAX helpers
Components 17
Book content
- Foundations
chapter_preliminaries - Model training
chapter_linear-regression - Computer vision
chapter_computer-vision - Language models
chapter_natural-language-processing-pretraining - Advanced topics
chapter_attention-mechanisms-and-transformers
Reference material
- Math reference
chapter_appendix-mathematics-for-deep-learning - Learning tools
chapter_appendix-tools-for-deep-learning
Example support
- Backend selection
d2l/__init__.py - PyTorch helpers
d2l/torch.py - TensorFlow helpers
d2l/tensorflow.py - JAX helpers
d2l/jax.py - MXNet helpers
d2l/mxnet.py
ML frameworks
- PyTorch
- TensorFlow
- JAX
- MXNet
Other components
- Reader
Connections 16
- Reader → Foundations: studies
README.md - Reader → Model training: studies
README.md - Reader → Computer vision: studies
README.md - Reader → Language models: studies
README.md - Reader → Advanced topics: studies
README.md - Reader → Math reference: consults
README.md - Reader → Learning tools: consults
README.md - Reader → Backend selection: runs examples with
README.md - Backend selection → PyTorch helpers: selects
d2l/__init__.py - Backend selection → TensorFlow helpers: selects
d2l/__init__.py - Backend selection → JAX helpers: selects
d2l/__init__.py - Backend selection → MXNet helpers: selects
d2l/__init__.py - PyTorch helpers → PyTorch: uses
d2l/torch.py - TensorFlow helpers → TensorFlow: uses
d2l/tensorflow.py - JAX helpers → JAX: uses
d2l/jax.py - MXNet helpers → MXNet: uses
d2l/mxnet.py