Syllabus Lesson 62 of 246 · Module 4: Your own autograd engine
Module 4: Your own autograd engine

The digit reader, on your own engine

Why it matters Same network as Module 3, but now no gradient formula appears in your training code. Getting the same accuracy proves your engine is right. Linear unlocks in the course library after this lesson.

The training loop is the one from the hook lesson. This time you write it yourself.

Words and symbols in this lesson
Tensor
here: an array plus its gradient plus the Tensors it came from
zero_grad
resetting gradients before the next step, because backward adds to them
Your turn

Write train(X, y, epochs, lr, seed) returning a trained MLP([64, 64, 10]), using only your engine (no hand-written gradients), and predict(net, X). Reach at least 95% on the 397 held-out digits.

Spotted a problem in this lesson? Report it · Ask about this lesson

This exercise opens soon

Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.