Background
Sections
IntroductionModule 01 β€” Tensors 🧊01 Β· Creating Tensors 🧊02 Β· Indexing & Reshaping πŸ”ͺ03 Β· Tensor Math βž—04 Β· Device Placement πŸ–₯️⚑Module 02 β€” Autograd βš™οΈ01 Β· The Computational Graph πŸ•ΈοΈ02 Β· Backward Pass & Gradients ⬅️03 Β· Turning Autograd Off πŸ›‘04 Β· Gradient Gotchas πŸͺ€Module 03 β€” Neural Networks01 Β· The `nn.Module` Basics 🧱02 Β· Common Layers 🧩03 Β· Building a Network πŸ—οΈ04 Β· Inspecting Models πŸ”Module 04 β€” Data Handling πŸ—‚οΈ01 Β· Dataset Basics πŸ“‡02 Β· The DataLoader 🚚03 Β· Transforms 🎨04 Β· Splits & Built-in Datasets βœ‚οΈModule 05 β€” The Training Loop πŸ”01 Β· Loss Functions 🎯02 Β· Optimizers βš™οΈ03 Β· The Training Loop πŸ”04 Β· Evaluation & Metrics πŸ“ŠModule 06 β€” Saving & Loading πŸ’Ύ01 Β· `state_dict` Basics πŸ’Ύ02 Β· Checkpoints & Resuming ⏸️03 Β· Loading for Inference πŸš€04 Β· Best Model & Early Stopping πŸ…Module 07 β€” Computer Vision πŸ‘οΈ01 Β· Convolutions πŸ”²02 Β· CNN Architecture πŸ›οΈ03 Β· Transfer Learning πŸ”04 Β· Image Classification Project πŸ§ͺModule 08 β€” NLP & Transformers πŸ’¬01 Β· Text Data & Tokenization πŸ”€02 Β· Embeddings 🧭03 Β· Recurrent Layers & LSTMs πŸ”„04 Β· Intro to Transformers ⚑Module 09 β€” Ecosystem: PyTorch Lightning ⚑01 Β· Why Lightning? πŸ€”02 Β· The LightningModule 🧩03 Β· The Trainer πŸŽ›οΈ04 Β· DataModules & Callbacks 🧰Module 10 β€” Deployment & Optimization πŸš€01 Β· Exporting Models πŸ“¦02 Β· `torch.compile` ⚑03 Β· Inference Optimization πŸͺΆ04 Β· Serving & Next Steps πŸŽ“

Module 01 β€” Tensors 🧊

2 min read

The single most important object in PyTorch. Get comfortable here and the rest of your journey gets dramatically easier.

Every image, sentence, and network weight in deep learning is ultimately just a big grid of numbers. The tensor is PyTorch's container for those numbers β€” a supercharged cousin of the NumPy array that can live on a GPU and remember how it was computed so gradients can flow backward during training. Master the tensor and you've learned the vocabulary the entire rest of PyTorch speaks.

This module is split into four bite-sized sub-modules. Work through them in order.

πŸ“š Sub-Modules

# Sub-Module What you'll learn
01 Creating Tensors Building tensors from data and factory functions, and controlling their dtype
02 Indexing & Reshaping Slicing, indexing, reshape/view, and the crucial views-vs-copies distinction
03 Tensor Math Element-wise ops, matrix multiplication (@), reductions, and broadcasting
04 Device Placement Moving tensors across CPU / CUDA / MPS and bridging to and from NumPy

🎯 By the end of this module, you'll be able to...

  • Create tensors of any shape and data type, from scratch or from existing data.
  • Slice, index, and reshape tensors confidently β€” without silently corrupting your data.
  • Perform element-wise and matrix math, and know exactly which is which.
  • Move tensors between the CPU and a GPU, and convert to/from NumPy.

βœ… Prerequisites

Basic Python and a working PyTorch install. If you haven't set up PyTorch yet, see the Quickstart in the root README.


➑️ Next up: Module 02 β€” Autograd, where these tensors learn to remember their own history so we can train with them.