Given the 4×4 single-channel input X=[12013−120021−210−12] and 2×2 filter W=[1−201] with bias b=0, stride 1 and no padding, what is the output after cross-correlation, ReLU activation and 2×2 max pooling with stride 1?

Deep learning, Convolutional networks
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can execute a 2-D convolution (cross-correlation), ReLU and max pooling accurately by hand.

Key idea

Slide the 2×2 filter W over every 2×2 patch of X without padding to get a 3×3 feature map Ci,j=∑a,bWa,bXi+a,j+b, clamp negative values to zero with ReLU⁡(z)=max⁡(0,z), and take the maximum over each 2×2 window.

Steps

  1. Find the convolution output size: with input n=4, kernel k=2, padding p=0 and stride s=1, the height and width are (4−2)/1+1=3, giving a 3×3 map C.
  2. Compute the 9 patch dot products with W=[1−201]. Top row: 1(1)−2(2)+0(3)+1(−1)=−4; 1(2)−2(0)+0(−1)+1(2)=4; 1(0)−2(1)+0(2)+1(0)=−2. Middle row: 1(3)−2(−1)+0(0)+1(2)=7; 1(−1)−2(2)+0(2)+1(1)=−4; 1(2)−2(0)+0(1)+1(−2)=0. Bottom row: 1(0)−2(2)+0(1)+1(0)=−4; 1(2)−2(1)+0(0)+1(−1)=−1; 1(1)−2(−2)+0(−1)+1(2)=7. So C=[−44−27−40−4−17].
  3. Apply ReLU⁡(z)=max⁡(0,z) element-wise: R=[040700007].
  4. Apply 2×2 max pooling with stride 1 (output size (3−2)/1+1=2): top-left max⁡(0,4,7,0)=7, top-right max⁡(4,0,0,0)=4, bottom-left max⁡(7,0,0,0)=7, bottom-right max⁡(0,0,0,7)=7. The final output is [7477].

Common mistakes

How long your answer should be

Half a page; 3–4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: Why do convolutional neural networks suit image data better than fully connected MLPs, and what is the difference between translation equivariance and translation invariance?
Next in Deep learning: An activation tensor of shape 28×28×192 passes through a 1×1 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 1×1 convolutions?