Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-085

Transposed Conv Output Size

Problem

Compute the spatial output size of a strided transposed convolution.

out = (n - 1) * stride - 2 * pad + k for each dimension, with no output padding. Given height h, width w, kernel size k, stride and pad, return [out_h, out_w].

Test cases

case 1
in: [7,7,3,2,1]
expected: [13,13]
case 2
in: [4,4,3,1,0]
expected: [6,6]
case 3
in: [6,6,4,2,1]
expected: [12,12]
case 4
in: [5,10,3,2,0]
expected: [11,21]
Starter codePython
def transposed_conv_output_size(h, w, k, stride, pad):
    # Your code here
    pass

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