Max-Pooling Backward Pass

medium
Unit 14 · Losses & CNNs0/3 to milestone

Max pooling passes gradient only to the input that won each window. With overlapping windows (stride < kernel), one input can win several windows and must accumulate their gradients.

For x: (N, C, H, W) with a square k × k window and a stride (no padding):

  • maxpool_forward(x, k, stride): return (out, cache) with out of shape (N, C, oh, ow), where oh = (H - k) // stride + 1
  • maxpool_backward(dout, cache): return dx. Within each window, the winner is the first maximum in row-major order.
#cnns#backprop#pooling2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Max-Pooling Backward Pass · TechGradify