Verified interview challenge
Matrix Prefix Products
Multiply an ordered sequence of matrices and work out how every prefix contributes to the gradient.
Unlock with Full AccessThe challenge
Start with an in-place implementation, then preserve PyTorch's autograd graph in an out-of-place version. Derive the backward pass yourself before expressing both passes with a supplied associative scan. The four parts share one Python file, with guided practice or a 75-minute timed mock.
What you'll practise
Ordered matrix products
Compute every prefix while respecting matrix order and tensor storage.
Manual derivatives
Account for gradients arriving at intermediate outputs as well as the final one.
Associative scan
Express a sequential recurrence as an operation that can combine adjacent ranges.
# Build on your implementation
# Run checks for the current part
# Full starter code includedRun your code to see results.