Building a PyTorch curriculum that teaches math through code, not as a prerequisite

I teach CS to underserved communities globally through a nonprofit, and I’m building a beginner-friendly PyTorch curriculum. The challenge: most PyTorch tutorials assume linear algebra and calculus fluency. I’m working on materials that build math intuition through PyTorch (using torch.autograd to visualize the chain rule, etc.) rather than as a prerequisite. Would love to hear what tripped people up when they first learned PyTorch.

For me, one of the biggest things was understanding the data flow while also tracking the dimensions after each stage. A lot of PyTorch becomes much clearer when learners can see how tensors move through the model: input shape, layer output shape, loss shape, gradient flow, etc. Once the shapes make sense, the math feels less abstract because you can connect every operation to what is happening in code.

When building your curriculum, I highly recommend introducing neural networks not as abstract biological neurons, but simply as mathematical operations. A great starting point is the elementary linear equation y=mx+b, which is technically a basic neural network where m and b act as the tunable weights. From there, you can easily transition into the three fundamental blocks of any machine learning model: (1) the architecture (the core mathematical function and its parameters that maps from some domain to another), (2) the loss function (a metric evaluating how well the model captures known properties of the target function, whether that means matching specific mappings like in supervised learning, aligning relationships of the outputs like in CLIP or JEPA, or satisfying differentials like in PINNs), and (3) optimization (the mechanism for updating the parameters based on those loss results).