Receptive Field of a CNN

medium
Unit 10 · CNNs0/3 to milestone

The receptive field is how many input pixels influence one output unit. For a stack of layers each with kernel kk, stride ss and dilation dd, track the receptive field rr and the cumulative stride ("jump") jj:

r←r+(keff−1) j,j←j⋅s,keff=d(k−1)+1r \leftarrow r + (k_{\text{eff}} - 1)\,j,\qquad j \leftarrow j \cdot s,\qquad k_{\text{eff}} = d(k-1)+1

starting from r=1,j=1r = 1, j = 1. Implement receptive_field(layers) where each layer is a dict with kernel, stride (default 1) and dilation (default 1). Return (r, j).

#cnn#architecture2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Receptive Field of a CNN · TechGradify