Max pooling is a spatial downsampling operation that divides an image or feature map into local windows and retains the largest value from each window. It reduces height and width while preserving prominent features, making it useful in convolutional networks and U-Net down blocks. section 6.2.3 section 6.3.1
Process each pooling operation as follows:
- Choose a kernel size, such as 2 × 2 or 3 × 3, to define each local window. section 6.2.3
- Move the window by the configured stride; a stride of 2 advances two pixels horizontally and vertically. section 6.2.3
- Select the maximum value inside every window and place it in the downsampled feature map. section 6.2.3
- With nn.MaxPool2d(2), a U-Net down block reduces input width and height by half. section 6.3.1
A 4 × 4 tensor with 2 × 2 pooling
Applying torch.nn.MaxPool2d(2) with the default stride to a 4 × 4 input produces [[2, 4], [5, 7]]. Each output value is the largest value in one non-overlapping 2 × 2 region. section 6.2.3
Figure 6.5 A numerical example of how max pooling works, with a kernel size of 2 × 2 and a stride equal to 2
Use the numerical figure to trace each 2 × 2 window, its selected maximum, and the resulting downsampled output. section 6.2.3









