Autograd does this for you. Interviewers ask you to do it by hand because knowing which axis to sum over is the difference between understanding backprop and having read about it.
Implement linear_backward(x, w, b, grad_out) for the layer y = x @ w + b:
x has shape (batch, in_features)w has shape (in_features, out_features)b has shape (out_features,)grad_out has shape (batch, out_features): the gradient of the loss with respect to yReturn the tuple (grad_x, grad_w, grad_b) with shapes matching x, w and b.
> PyTorch is not available in this environment, and that is deliberate: the NumPy version is what gets asked in interviews, because it is the one that shows whether you know where the transpose goes.
Build the architecture on a canvas: place the components, configure them, connect them into a data flow, and write a short reason for each one. The AI reviewer grades your design against a rubric written specifically for this problem.
Minimum 5 components · needs a wide desktop screen