We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Learn PyTorch
Zero to hero on PyTorch itself. Not machine learning that happens to be written in PyTorch, but the library: tensors, shapes, memory, autograd, and the mechanics that separate code that runs from code that ships.
Every problem is graded on a measured cost or a deterministic wrong answer, never on prose. If the task is to take a view instead of a copy, the test counts allocations. If it is to fuse three passes into one, the test times them. You cannot pass by describing the right answer.
A path is a run of tracks in order. Each one stands alone, so you can start anywhere and come back.
-
Orientation and the Grade
What "graded" means here, before any PyTorch is taught. A solution that returns exactly the right numbers and still fails, because it copied a buffer it could have viewed. The rule is learned once rather than resented later.
-
Shapes and Strides
The model everything else rests on: a tensor is a buffer, a shape and a stride, and most of what looks like work is arithmetic on the last two. Where
viewsucceeds, where it refuses, and whyreshapeis not a synonym. -
Indexing and Selection
Two indexing systems wearing one syntax. Basic indexing hands you a window on the same memory; advanced indexing hands you a copy. Confusing them is the most common way a tensor bug becomes an aliasing bug.
-
Broadcasting
The rules in full, then the bugs they enable. A missing
unsqueezedoes not raise — it silently produces an (n, n) where you meant an (n,), and every number downstream is wrong but plausible. -
Reductions and dim
dimis the axis that disappears, and nearly every reduction bug is a disagreement about which one that is. Plus the reductions that are wrong before they are slow: integer means, unstable sums, ties in argmax. -
Matmul and einsum
Batched matrix multiplication and its broadcasting rules, then einsum as the tool that collapses a transpose, a matmul and a sum into one op that says what it means.
-
Memory, Copies and In-Place
Clone, detach,
copy_,out=, preallocation. When an in-place op is the right answer, when it is a correctness bug, and how to tell which situation you are in from the code alone. -
Dtypes and Numerics
Promotion rules, integer division, accumulation error and float comparison. This track grades almost entirely on deterministic wrong answers, because that is how these failures actually arrive: not as an exception, as a number.
-
Autograd Mechanics
The graph as an object you can inspect. Leaves,
grad_fn, accumulation, and the exact difference betweenno_gradanddetach— measured by counting the nodes each one does or does not build. -
Devices and Data Movement
Device-agnostic code, and the discipline of moving data once. Graded by counting the copies your code causes rather than by owning a GPU, so the lesson holds on the machine you have.
-
nn.Module Mechanics
What a Module actually is: a registry of parameters, buffers and children with hooks on the edges. Parameters versus buffers,
state_dictround-trips, whattrain()really changes, and weight sharing that survives a save. -
Batching and the Data Path
Stack versus cat, padding and masks, collate functions, and shuffling you can reproduce. The layer where shape bugs are cheapest to prevent and most expensive to find.
-
Performance
Everything before this, applied and measured. Fusing an elementwise chain, deleting a Python loop, preallocating, and not calling
.item()in one. Benchmarked, so the improvement is a number rather than a claim.