Max pooling

Pooling · node type · MaxPool, GlobalMaxPool

Keeps only the strongest response in each window, shrinking the map and tolerating small shifts.

Also called MaxPool, Global max pooling

A 2 × 2 window with stride 2 halves each side. Pick an output cell to see which inputs it summarizes. No weights are learned here.

Global max pool of the whole grid: 6

Input 6 × 6

132014521302016231241052302411123126

Output 3 × 3

max(1, 3, 5, 2) = 5

Figure 1. Try it: every number is computed in your browser from the formula below.

What it does

Max pooling slides a window over each channel separately and outputs the largest value inside it. It has nothing to learn. It halves (or more) the height and width, which cuts the work of later layers, and because only the maximum survives, a feature that moves by a pixel or two inside the window still produces the same output. Global max pooling uses one window covering the whole map, turning [C, H, W] into a single value per channel, which is how 1D text CNNs pick the strongest n-gram match anywhere in a sentence.

Formula

Y[c, y, x] = max0 ≤ i, j < k X[c, s·y + i, s·x + j]

Shapes and parameters

Shapes
Input [N, C, H, W]; output [N, C, H', W'] with H' = ⌊(H − k) / s⌋ + 1. Global pooling gives [N, C, 1, 1].
Parameters
None. Pooling has no weights; the channel count stays the same.
Used for
Between convolution stages in classic CNNs, in keyword spotting models, and as global max pooling in text CNNs.

Figure 2. Max pooling inside Classify the tone of a film review, a real model in WeightSpace. The outlined node is Max pooling; select any node for its shapes and parameters.

Figure 3. The typed ports of Max pooling, in the same format as every model drawing. Letters such as N or C stand for any size.

In WeightSpace

Read-only in WeightSpace today: there is nothing learned inside it. The voice command and text sentiment models use it, and are edited through their classifier biases further on.