explaingit

d2l-ai/d2l-en

Analysis updated 2026-06-20

28,774PythonAudience · researcherComplexity · 3/5LicenseSetup · moderate

TLDR

Dive into Deep Learning is a free, interactive AI textbook that teaches deep learning from scratch using runnable Python code in Jupyter notebooks, adopted by hundreds of universities including Stanford, MIT, and Cambridge.

Mindmap

mindmap
  root((d2l-en))
    What it is
      Free AI textbook
      Jupyter notebooks
      Runnable examples
    Topics covered
      Computer vision
      Natural language
      Optimization
      Gaussian processes
    Audience
      Students
      Self-learners
      University courses
    Tech stack
      Python
      PyTorch
      TensorFlow
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Work through a complete deep learning curriculum from basics to advanced topics with hands-on code you can run and modify immediately.

USE CASE 2

Use individual chapters as structured teaching material for a university course or self-study group on AI and neural networks.

USE CASE 3

Experiment with and tweak working neural network implementations without building examples from scratch.

USE CASE 4

Study computer vision, NLP, and optimization techniques side-by-side with the mathematical explanations that explain why they work.

What is it built with?

PythonJupyterPyTorchTensorFlowMXNet

How does it compare?

d2l-ai/d2l-enebazhanov/linkedin-skill-assessments-quizzesvectifyai/pageindex
Stars28,77428,73328,663
LanguagePythonPythonPython
Setup difficultymoderateeasyeasy
Complexity3/51/53/5
Audienceresearcherdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Python and a deep learning framework (PyTorch or TensorFlow), a GPU is recommended for the larger training examples.

Free to read, share, and adapt for any purpose including teaching under a Creative Commons license.

In plain English

D2L.ai, short for "Dive into Deep Learning," is a free, open-source textbook designed to teach deep learning (the branch of AI that powers things like image recognition, chatbots, and recommendations) by combining explanations, math, and runnable code all in one place. The idea is that the best way to understand these concepts is to actually run and tweak the code yourself, not just read theory. The book lives as a collection of Jupyter notebooks, interactive documents where you can read the explanation and execute the code in the same window. Each chapter covers a concept, then shows you working code examples you can run immediately without any extra setup. Who would use this? Anyone who wants to go from "I've heard of AI" to "I can actually build and train models", whether you're a student, a self-taught developer, a PM wanting to understand the technology, or a founder evaluating what's technically possible. It assumes some math familiarity but no prior AI experience. It's been adopted by hundreds of universities including Stanford, MIT, Harvard, and Cambridge, which signals that it's structured enough for formal coursework but accessible enough for self-study. The codebase and content are written in Python, and the notebooks are designed to run on multiple deep-learning frameworks so you're not locked into one ecosystem. Topics include computer vision (teaching computers to see), data science fundamentals, and advanced techniques like Gaussian processes and hyperparameter optimization. The book is free under a Creative Commons license, and there's an active community forum for questions.

Copy-paste prompts

Prompt 1
I'm studying Chapter 3 of Dive into Deep Learning on linear neural networks. Help me modify the training loop to add L2 regularization and plot the effect on overfitting.
Prompt 2
Based on d2l's approach, show me how to implement the attention mechanism from Chapter 11 and apply it to a custom sequence classification task.
Prompt 3
I want to adapt the CNN from d2l Chapter 7 to classify my own image dataset. What changes do I need to make to the model definition and data loading code?
Prompt 4
Using the d2l library utilities, set up a training experiment that logs loss and accuracy per epoch and saves the best-performing model checkpoint.

Frequently asked questions

What is d2l-en?

Dive into Deep Learning is a free, interactive AI textbook that teaches deep learning from scratch using runnable Python code in Jupyter notebooks, adopted by hundreds of universities including Stanford, MIT, and Cambridge.

What language is d2l-en written in?

Mainly Python. The stack also includes Python, Jupyter, PyTorch.

What license does d2l-en use?

Free to read, share, and adapt for any purpose including teaching under a Creative Commons license.

How hard is d2l-en to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is d2l-en for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub d2l-ai on gitmyhub

Verify against the repo before relying on details.