Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-223

Dilated Conv Output Size

Problem

Compute the output size of a dilated convolution.

The effective kernel is dilation * (k - 1) + 1; out = (n + 2 * pad - effective_k) // stride + 1 for each dimension. Return [out_h, out_w].

Test cases

case 1
in: [28,28,3,1,0,1]
expected: [26,26]
case 2
in: [28,28,3,1,0,2]
expected: [24,24]
case 3
in: [28,28,3,1,2,2]
expected: [28,28]
case 4
in: [16,16,3,2,1,2]
expected: [7,7]
Starter codePython
def dilated_conv_output_size(h, w, k, stride, pad, dilation):
    # Your code here
    pass

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