Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Cheat sheet · Specialise

PyTorch cheat sheet

Opens with credits

A quick-revision book on PyTorch for engineers who train and ship neural networks. It follows the order you meet things in a real project: tensors, autograd, models, data, the training loop, then speed, scale, debugging and export.

Curated by Tauseef Fayyaz9 chapters59 concepts83 glossary terms

Chapters

9 chapters · 59 concepts

  1. 1TensorsThe n-dimensional array every PyTorch program is built on: how to create one, what it holds, how it is shaped and where it lives.7 concepts
  2. 2AutogradHow PyTorch computes gradients for you: it records operations on tensors that need gradients, then walks that record backwards.6 concepts
  3. Models with nn.ModuleHow to define a network: a class that owns its layers and says how data flows through them, plus the common building blocks.7 conceptsOpens with credits
  4. Losses, optimisers and schedulersWhat the model minimises, the algorithm that updates the weights, and how the learning rate changes over time.7 conceptsOpens with credits
  5. Datasets and DataLoadersHow data reaches the model: a Dataset knows how to fetch one example, and a DataLoader batches, shuffles and loads them in parallel.6 conceptsOpens with credits
  6. Training, evaluation and checkpointsThe loop you write in every project, the evaluation loop beside it, and how to save and restore work.7 conceptsOpens with credits
  7. Speed: GPUs, mixed precision and torch.compileThe switches that make the same model train faster and fit in less memory.7 conceptsOpens with credits
  8. Debugging trainingHow to find out why a model will not run, will not learn or learns the wrong thing.6 conceptsOpens with credits
  9. Distributed training and exportTraining on several GPUs, and turning a trained model into something another program can run.6 conceptsOpens with credits
  10. 10Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.83 terms

About this sheet

Tensors, autograd, nn.Module, training loops, data loading, GPUs, mixed precision, torch.compile, DDP and export in PyTorch.

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com