← Questions

Minimal reverse-mode autograd engine

0
OpenAICodingLast asked Sep 2026

With PyTorch available, write the core of an automatic differentiation engine yourself. Build a small Tensor wrapper whose operations record how each result was computed, and a backward() method that walks that graph in reverse and fills in the gradient of every input.

Support a handful of basic operations, make sure gradients add up correctly when a value is used more than once, and check your gradients against PyTorch's own autograd.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding