NumPy allowed · plain Python earns 10 bonus points
θ ← θ − 0.14 · ∂L/∂θ
Route backpropagated errors solely to the active argmax elements that contributed to downstream pooling activations.
Implement max_pool2d_backward(...). Initialize grad_input to zeros with shape (H_in, W_in). For each pooling window (i, j), find the index (max_r, max_c) corresponding to the maximum value in input_map[i*stride : i*stride+pool_size, j*stride : j*stride+pool_size]. (If multiple elements tie, pick the first in row-major order). Add grad_output[i][j] to grad_input[max_r][max_c]. Round all elements in grad_input to 4 decimal places.
max_pool2d_backward(input_map: list[list[float]], grad_output: list[list[float]], pool_size: int = 2, stride: int = 2) -> list[list[float]]