Unit 2 of 7 · about 4 hours · derive

Pooling, transposed convolution, receptive fields and cost

Resolution sets both what a unit can see and what training costs. A receptive field smaller than the object and an activation bill larger than memory fail the same run.

You'll be able to

  • Derive receptive-field growth across stride, kernel and dilation choices.
  • Count parameters, multiply-adds and activation bytes for a stated conv stack.
  • Explain transposed convolution as learned upsampling and state when it is not an inverse.

Covers

Pooling and transposed convolution at recognition depthReceptive fields, parameters, FLOPs and activation memory
1

Read

In this order, only the parts listed

0 of 3 done

  1. Pooling from scratchD2L - convolutional and recurrent architecture route

    Section 7.5: Maximum and Average Pooling (pool2d from scratch), Padding and Stride, and Multiple Channels

  2. Transposed convolutionD2L - convolutional and recurrent architecture route

    Sections 14.10.1 and 14.10.2: Basic Operation and Padding, Strides, and Multiple Channels, including Connection to Matrix Transposition

  3. Receptive fields, downsampling and upsamplingUnderstanding Deep Learning - convolution and residual networks

    Chapter 10, Sections 10.2.6 and 10.4 (pp. 167 to 174): receptive fields with Figure 10.6, and downsampling plus upsampling with Figures 10.11 to 10.13

    Skip Section 10.5 Applications. Detection and segmentation are later topics.

2

Focus on

  • Receptive field grows by times the product of earlier strides per layer. Stride-2 downsampling doubles the growth rate while quartering activations.
  • One conv layer holds times times times weights plus biases, and costs about twice that many FLOPs per output position for the multiply-add.
  • Pooling has no parameters, acts per channel, and stride-2 pooling quarters resolution. Max-pooling gives limited shift tolerance inside a window, not invariance.
  • A transposed convolution applies the transpose of a downsampling weight matrix. It learns an upsampling and is not an inverse of any forward convolution.
Common mistakes · 3
  • Quoting parameter counts as cost. FLOPs and activations scale with resolution, so doubling both sides quadruples both.
  • Calling transposed convolution an inverse by name. It shares only the naming pattern, so its outputs need their own checks.
  • Treating the receptive-field formula as uniform coverage. Center pixels feed more paths than edge pixels, so the formula gives the maximum extent.
3

Try it yourself

Closed-book, before checking anything

Closed-book, compute for a input with Conv2d(64, 128, kernel_size=3, stride=1, padding=1): output , 73,856 parameters, about 4.6e8 FLOPs, and about 1.6 MB of float32 output activations. Then grow the receptive field through two more layers to 7.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Three layers on a 1D input. What is the receptive-field size?Answer

    7: . Each layer adds 2 to the extent at stride 1.

  2. 2.Stride-2 pooling quarters the positions. Why does it not quarter the compute of the next stage?Answer

    Networks usually double the channels after downsampling. Convolution cost scales with positions times times , so doubling both channel counts restores the FLOPs exactly, while activation memory only halves.

  3. 3.Does a transposed convolution invert the convolution with the same weights?Answer

    No. It applies the transposed weight matrix with its own learned weights, so equal shape back does not mean equal values.

  4. 4. stride-2 max-pooling. Which input shifts leave the output unchanged?Answer

    A shift by 2 pixels shifts the output by one cell (equivariance on the coarse grid). A one-pixel shift leaves an output unchanged only when that window's maximum stays inside the window, which depends on the data; test with a shifted copy.

5

Practice

You're done when

Your hand counts match the weight-shape formula on a new layer, and a shifted-input probe shows exactly which pooling outputs move.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 5 more in the section

Also in this section

  • Stanford CS231n - Assignments 1 and 2Stanford University · support

    Use only the neural network, normalization, dropout, convolution and PyTorch components that match this section. Do not complete the course or unrelated vision tasks.

  • Deep-ML candidate - convolution and recurrence problemsDeep-ML · optional

    After the platform admission check, use at most one of 41 Conv2D, 62 RNN with BPTT, 287 GRU or 59 LSTM as a changed-prompt drill.

  • TrenTorch - convolution cost and recurrent cellsTrenTorch · support

    Solve FLOPs Estimation, GRU Forward and LSTM Forward after the D2L scratch models. Each reference cell matches torch.nn.GRUCell or LSTMCell.

  • PyTorch nn.Conv2d referencePyTorch · reference

    Read Signature and Shape for the exact floor formula with dilation, the groups divisibility rule with grouped and depthwise examples, and the weight layout . D2L and UDL teach the mechanism; this page is the shape contract to code against.

  • PyTorch sequence packing utilitiesPyTorch · reference

    Read pack_padded_sequence for lengths, enforce_sorted and batch-first at recognition depth: what packing skips and what contract it demands. Do not reimplement the packed format; pair it with the masked-loss implementation in D2L seq2seq.