Part 6 of 6 · What interviewers ask nextCheck yourself
Check yourself
5 questions
1.y = a @ b with a of shape (8, 16) and b of shape (16, 32). Which line computes the gradient for a?
2.Your backward ends with return grad_b, grad_a. With a of shape (3, 4) and b of shape (4, 5), PyTorch raises an error. What happens when a and b are both (4, 4)?
3.You average grad_b over the batch instead of summing it. The practice's batched tests use a batch of 2. What do the tests see?
4.a is (S, n, k) and b is (k, m). Your backward returns a.transpose(-1, -2) @ grad_out for b and never sums it. What happens in PyTorch?
5.a is (n, k) and b is (k, m), and both need gradients. The forward costs 2nkm FLOPs. What does the backward cost?