Exercises — Pooling layers (max, average)
This page is a self-test. Each problem builds on the parent note Pooling Layers. Solutions are hidden inside collapsible callouts — try first, then reveal.
Before we start, one reminder of the only two formulas you need for sizing. If a feature map has height , we slide a window of side (the "pool size") and jump pixels each time (the "stride"). The number of window positions that fit is:
The two operations themselves, on one window of numbers:
- Max pooling keeps the single largest number.
- Average pooling adds all numbers and divides by (the mean).
Prerequisites if any symbol feels new: Feature Maps, Stride and Padding, Receptive Field.
Level 1 — Recognition
Exercise 1.1
An input feature map is . You apply max pooling with stride . What is the output height and width?
Recall Solution
Plug into the formula with , , : By symmetry too. Output: . Sanity check: non-overlapping pooling halves each side, and . ✓
Exercise 1.2
Look at the single window below. State the max-pooling result and the average-pooling result.
[2 9]
[4 1]
Recall Solution
Max: the largest of is . Average: . Notice max () is pulled toward the peak; average () sits in the middle of all four.
Exercise 1.3
True or false: a pooling layer has learnable weights that get updated during training.
Recall Solution
False. Both max and average pooling are fixed operations — no weights, no biases, nothing to learn. Contrast this with Convolutional Layers, whose filters do have learnable weights.
Level 2 — Application
Exercise 2.1
Apply max pooling, stride , to this map. Give the full output.
[3 8 1 0]
[2 5 9 4]
[7 6 2 2]
[1 0 3 8]

Recall Solution
Four non-overlapping windows (see the four coloured tiles in the figure):
- Top-left → max
- Top-right → max
- Bottom-left → max
- Bottom-right → max
Exercise 2.2
An input is . Apply pooling with stride . What is the output size? Does any input row get ignored?
Recall Solution
Output: . Window start positions along one axis are . The last window covers rows — so row 6 is the final row used and nothing is ignored here. (If the input were : , starts , last window covers rows and row 7 is dropped by the floor.)
Exercise 2.3
Apply average pooling, stride , to the same map as Exercise 2.1. Give the output.
Recall Solution
- Top-left
- Top-right
- Bottom-left
- Bottom-right
Notice every output is smaller and smoother than the max version — averaging drags peaks down toward the crowd.
Level 3 — Analysis
Exercise 3.1
Forward pass of Exercise 2.1 gave output . The next layer sends back the gradient
dL/dY:
[0.2 0.5]
[0.1 0.4]
Route this gradient back through the max pooling to fill in the dL/dX.

Recall Solution
In max pooling, only the winning position in each window carried information forward, so by the chain rule only it receives gradient; every other cell gets .
- Top-left winner was at row 0, col 1 → gets
- Top-right winner was at row 1, col 2 → gets
- Bottom-left winner was at row 2, col 0 → gets
- Bottom-right winner was at row 3, col 3 → gets
Sum of all entries , which equals the sum of dL/dY — no gradient is created or destroyed, just re-routed.
Exercise 3.2
Route the same dL/dY back through average pooling () instead. What does the top-left window's dL/dX look like?
Recall Solution
Average pooling used all four inputs equally (each contributed to the output). So the gradient is split evenly among the four: Compare to max pooling, where a single cell got the whole . Average pooling gives dense gradients; max pooling gives sparse ones.
Exercise 3.3
Two consecutive , stride-2 pooling layers are applied to an input. A single output neuron of the second pooling layer looks back at how many original input pixels? (This is its Receptive Field.)
Recall Solution
One 2nd-layer neuron summarizes a block of 1st-layer neurons. Each of those summarizes a block of the input. So along one axis it spans pixels, and over 2D: Each pooling stage doubles the receptive-field width, which is exactly why stacking pooling makes deep neurons "see" more of the image.
Level 4 — Synthesis
Exercise 4.1
Design a pooling stage. You have a feature map and want the output to be exactly using a window. What stride do you choose, and prove it works.
Recall Solution
Try : Stride . This is standard non-overlapping halving. (Stride would give ; stride would give — too small.)
Exercise 4.2
You are told a network replaces its final flatten-plus-dense block with Global Average Pooling. The last feature map is channels, each . What is the output vector length, and how many learnable parameters did this pooling introduce?
Recall Solution
Global average pooling collapses each entire channel to its single mean value. So each of the channels becomes one number: Learnable parameters introduced by the pooling: (pooling is parameter-free). This is precisely why GAP shrinks model size versus a dense layer, which would need inputs times its output units in weights.
Exercise 4.3
Overlapping pooling: a map, window, stride . Find the output size and the overlap (in pixels) between two horizontally adjacent windows.
Recall Solution
Output size: Overlap between neighbours pixels. Adjacent windows start one pixel apart but each is wide, so they share columns. This is the "overlapping pooling" from the parent note's Mistake 2.
Level 5 — Mastery
Exercise 5.1
A feature map contains one strong activation of value surrounded by zeros in a window: . Compare how max vs average pooling represent this "sharp feature," and explain why max pooling is preferred for detecting sparse, localized features like edges.
Recall Solution
- Max: output . The feature's presence and strength survive intact.
- Average: . The single strong signal is diluted 4× by its zero neighbours.
For sparse detectors (an edge fires in only a few pixels), max pooling reports "yes, the feature is here, at full strength," giving Translation Invariance: it does not matter which of the four cells fired, the output is either way. Average pooling would report a weak and would change if the feature spread across more cells — worse for crisp detection. This is why architectures like VGG Network use max pooling between conv blocks.
Exercise 5.2
Prove that for average pooling, the routed-back gradient over one window always sums to exactly the incoming gradient , for any .
Recall Solution
Each of the input cells in the window receives . Summing over all cells: So the total is conserved — average pooling neither amplifies nor loses gradient magnitude, it merely spreads it. (The same conservation held for max pooling in Exercise 3.1, but there all of went to a single cell.)
Exercise 5.3
A map goes through pooling, stride , then pooling, stride . Find the final spatial size. Note any pixels dropped by a floor.
Recall Solution
Stage 1: . Starts cover all rows exactly — nothing dropped. Stage 2: input is : . Window start covers rows ; row 2 is dropped by the floor. Final size: . This mirrors how the tail of a deep net (e.g. before the classifier in a ResNet Architecture) collapses spatial dimensions down to a single vector.
Recall Quick self-check (clozes)
Max pooling routes its gradient to only the argmax cell (the winner). Average pooling routes its gradient to ==all cells equally, each getting ==. Number of learnable parameters in any pooling layer ::: Zero. Output size formula ::: .
Related: Global Average Pooling · Feature Maps · Translation Invariance · 3.4.03 Pooling layers (max, average) (Hinglish)