Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-231

U-Net Skip Connection Shape

Problem

List the U-Net encoder shapes level by level. Starting at 64 channels, every level halves the spatial dimensions with floor division and doubles the channel count.

The signature is unet_skip_shape(input_h, input_w, depth). Return [[h, w, channels], ...] for levels 0 through depth.

Hint

Skip connections need encoder and decoder shapes to match exactly at every level.

Test cases

case 1
in: [32,32,2]
expected: [[32,32,64],[16,16,128],[8,8,256]]
case 2
in: [16,24,1]
expected: [[16,24,64],[8,12,128]]
case 3
in: [8,8,0]
expected: [[8,8,64]]
case 4
in: [5,5,1]
expected: [[5,5,64],[2,2,128]]
Starter codePython
def unet_skip_shape(input_h, input_w, depth):
    # Your code here
    pass

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