From the loop to a library
The topic What deep learning is reduced training any network to one loop: take a batch, run the model forward, compute the loss, run backward for the gradient, take a step. A library must supply four things for that loop: arrays that hold batches and parameters, a forward pass that remembers what it computed, a backward pass that turns that memory into gradients, and optimizers that apply them. This topic covers how PyTorch supplies each, builds reverse-mode differentiation for scalars from scratch, and ends with the bugs that make a pipeline run without errors and still train badly.
Notation. is a scalar loss and is the adjoint of a quantity , with the same shape as . A tensor's shape is written like ; dimension 0 is the first. is the learning rate.