Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-086

Receptive Field Size

Problem

Compute the receptive field size of a stack of convolution layers.

Start with rf = 1 and jump = 1, then for each (kernel, stride) pair do rf += (kernel - 1) * jump and jump *= stride. The two input lists have equal length.

Hint

Each layer extends the field by (k - 1) times the current jump.

Test cases

case 1
in: [[3],[1]]
expected: 3
case 2
in: [[3,3],[1,1]]
expected: 5
case 3
in: [[3,3,3],[2,2,2]]
expected: 15
case 4
in: [[5,3],[2,1]]
expected: 9
Starter codePython
def receptive_field(kernels, strides):
    # Your code here
    pass

4 test cases · run your code against them in the editor