Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-231

TCN Receptive Field

Problem

Compute the receptive field of a stack of dilated causal convolutions: 1 + (kernel_size - 1) * sum(dilations).

Each dilation multiplies how far the layer looks back, so the field grows quickly with depth.

Hint

With no layers the field is just the current position.

Test cases

case 1
in: [3,[1,2,4]]
expected: 15
case 2
in: [2,[1,1,1]]
expected: 4
case 3
in: [3,[]]
expected: 1
case 4
in: [5,[1,2]]
expected: 13
Starter codePython
def tcn_receptive_field(kernel_size, dilations):
    # Your code here
    pass

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