Max pooling
You will learn
What max pooling keeps, where it remembers taking it from, and where the gradient goes.
Max pooling keeps the largest value of each window and drops the rest, so the network cares less about exactly where a feature sits. On the spec's 4 x 4 grid, 2 x 2 windows with stride 2 keep 4, 8, 9 and -2, taken from cells 5, 6, 13 and 11. Overlapping 3 x 3 windows with stride 1 keep 8, 8, 9 and 9. In the backward pass each window's whole gradient goes to its maximum: gradients 1, 2, 3 and 4 land on cells 5, 6, 13 and 11, and every other cell gets 0. The spec maxpool2d_layer.t27 computes the outputs, their positions and the gradient.