A small CNN takes a image through: (1) a conv with 16 filters, stride 1, padding 1; (2) max pooling, stride 2; (3) a conv with 32 filters, stride 1, padding 1; (4) global average pooling; and (5) a 10-class linear head. Including biases, what are the output shape after each layer and the total parameter count, and why does global average pooling avoid a parameter explosion?
Deep learning, Classic architectures
Level L2 Elementary. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can trace tensor shapes and parameter counts through a multi-layer CNN and compare global average pooling with flattening.
Key idea
Use for spatial dimensions (where is input size, is padding, is kernel size and is stride) and for conv parameters (with input and output channels). Global average pooling collapses each feature map to a single number, leaving only features for the linear head.
Steps
- Layer 1 ( conv, 16 filters, ): , so shape is . Parameters: .
- Layer 2 ( max pool, ): , so shape is . Pooling has learnable parameters.
- Layer 3 ( conv, 32 filters, ): shape is . Parameters: .
- Layer 4 (global average pooling): averages each of the 32 maps of size , giving shape (a 32-D vector) with parameters.
- Layer 5 (10-class linear head): output shape is , with parameters. Total parameters: .
- Comparison with flattening: flattening the tensor instead would feed numbers into the 10-class head, requiring head parameters (about more in the head alone) and encouraging overfitting.
Common mistakes
- Using input channels for layer 3 instead of the output channels produced by layer 2.
- Assigning learnable parameters to max pooling or global average pooling.
How long your answer should be
Half a page; 3–4 minutes.
Last checked on 4 December 2026.
Read this
Previous in Deep learning: An activation tensor of shape passes through a convolutional layer with 64 filters (including biases). What are the output shape, the number of learnable parameters and the multiply-accumulate (MAC) count, and why do architectures such as Inception and ResNet use convolutions?
Next in Deep learning: What single key architectural change did each of AlexNet, VGG, Inception, ResNet and DenseNet introduce over prior CNNs?