Build a 3-layer PyTorch MLP by hand in 7 steps: the paper exercise that tests if you really understand nn.Linear

ProfTomYeh · x · 2026-09-24

ProfTomYeh shares his three-year-old "MLP by hand" exercise: a PyTorch code template with blanks, derivable entirely from the network diagram on paper.

Three years ago students found the paper-based exercise odd — every other course lived in Jupyter. Now colleagues are rushing to move their materials to paper. The point: paper forces the one question notebooks let you skip — do you actually understand what the code does? If you can explain why the matrix is 4×3 and why bias=F, you understand nn.Linear better than someone who has copy-pasted it for a year.

Original post →

More from Research

Research channel →