Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-225

Residual Output Shape

Problem

Compute the output shape of a residual block's main convolution path.

out = (n + 2 * pad - k) // stride + 1 for each spatial dimension, with the channel count unchanged. Return [out_h, out_w, channels].

Test cases

case 1
in: [32,32,64,3,1,1]
expected: [32,32,64]
case 2
in: [32,32,64,3,2,1]
expected: [16,16,64]
case 3
in: [56,56,128,1,1,0]
expected: [56,56,128]
Starter codePython
def residual_output_shape(h, w, c, k, stride, pad):
    # Your code here
    pass

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