PyTorch Tutorials
by PyTorch (Linux Foundation)
Executable official tutorials from your first tensor to FSDP, quantization and ONNX export.
Overview
The official PyTorch tutorials are maintained in the pytorch/tutorials repository under a BSD-3-Clause licence with roughly 9,300 stars, and built with sphinx-gallery, which means every page is generated from a Python file that is actually executed - so each tutorial carries Run in Google Colab and Download Notebook buttons and the outputs you read are real rather than pasted. The current build tracks PyTorch 2.13 with CUDA 13. Content is grouped into about a dozen tracks: Learn the Basics and the 60 Minute Blitz for newcomers; PyTorch Recipes as short single-task snippets; domain tracks for image and video, audio via torchaudio, NLP, and recommender systems via TorchRec; and then the engineering tracks that matter once a model works at all - model optimization covering torch.compile, profiling, pruning and quantization, parallel and distributed training covering DDP, FSDP, tensor parallelism and RPC, production export through ONNX, edge deployment through ExecuTorch, and frontend extensions in C++ and CUDA. The 60 Minute Blitz itself is four parts: tensors, a gentle introduction to torch.autograd, building networks with nn.Module, and training an image classifier on CIFAR-10; it remains the fastest honest path from zero to a training loop you wrote yourself. Because Transformers, PEFT, TRL, vLLM and effectively the entire open-model stack are built on PyTorch, this is the layer underneath the libraries you already call, which is what makes it worth reading even if you never write a model from scratch.
At a Glance
- Topic
- Frameworks
- Level
- All Levels
- Format
- Tutorial
- Cost
- Free
- Duration
- Self-paced; the 60 Minute Blitz is ~1 hour, the full tracks are many days
- Provider
- PyTorch (Linux Foundation)
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Create and manipulate tensors and move them between CPU and GPU memory
- ✓Use autograd to compute gradients without writing any derivatives by hand
- ✓Build a network with nn.Module and train it end to end on CIFAR-10
- ✓Save, load and export models, including ONNX export for production serving
- ✓Speed up training and inference with torch.compile and quantization
- ✓Scale a training job across GPUs with DistributedDataParallel and FSDP
- ✓Profile memory and compute to find where a training run is actually slow
Highlights
- •Every tutorial is executable - Colab and notebook downloads on each individual page
- •Built from executed source via sphinx-gallery, so the printed outputs are genuine, not transcribed
- •Covers the unglamorous production tracks: distributed training, quantization, ONNX and ExecuTorch
- •Official and versioned against the current release rather than a stale third-party course
- •This is the layer beneath Transformers, PEFT, TRL and vLLM, so debugging them means reading these
Who It’s For
Best For
- ✓Developers moving from using models to training and modifying them
- ✓Engineers who specifically need distributed training or inference optimization
- ✓Anyone who wants to read research code instead of only calling APIs
Prerequisites
- •Python including classes - nn.Module subclassing shows up everywhere
- •NumPy familiarity helps, since the tensor API deliberately mirrors it
- •A GPU for the later tracks, though the basics run fine on CPU
FAQ
What is PyTorch Tutorials?
The official PyTorch tutorial set, built from source files that are actually executed, so every page ships a Colab link, a downloadable notebook and real printed output. It spans the 60 Minute Blitz and Learn the Basics through vision, audio and NLP tracks into the production engineering that matters later: torch.compile, profiling, quantization, distributed training, ONNX export and edge deployment.
Is PyTorch Tutorials free?
PyTorch Tutorials is free to access.
What level is PyTorch Tutorials for?
PyTorch Tutorials is aimed at a all levels audience. Recommended background: Python including classes - nn.Module subclassing shows up everywhere, NumPy familiarity helps, since the tensor API deliberately mirrors it, A GPU for the later tracks, though the basics run fine on CPU.
How long does PyTorch Tutorials take?
Expect roughly Self-paced; the 60 Minute Blitz is ~1 hour, the full tracks are many days. Most learners work through it at their own pace.
What will I learn from PyTorch Tutorials?
You'll learn: Create and manipulate tensors and move them between CPU and GPU memory; Use autograd to compute gradients without writing any derivatives by hand; Build a network with nn.Module and train it end to end on CIFAR-10; Save, load and export models, including ONNX export for production serving; Speed up training and inference with torch.compile and quantization; Scale a training job across GPUs with DistributedDataParallel and FSDP; Profile memory and compute to find where a training run is actually slow.
Topics
Sources
This page was written from 3 sources, 1 on domains other than docs.pytorch.org.