All problems
HRNet Fusion Step
Problem
Fuse a low-resolution branch into a high-resolution branch. Upsample the low-resolution vector by repeating each element (len(high_res) / len(low_res) times), then return high_res + weight * upsampled.
The signature is hrnet_fusion_step(low_res, high_res, weight). The lengths must divide evenly.
Hint
HRNet keeps a high-resolution stream alive and fuses lower-resolution streams into it repeatedly.
Test cases
case 1
in: [[1,2],[10,20,30,40],0.5]
expected: [10.5,20.5,31,41]
case 2
in: [[0,0],[1,1,1,1],1]
expected: [1,1,1,1]
case 3
in: [[5],[2,4],0.5]
expected: [4.5,6.5]
case 4
in: [[1,2,3],[0,0,0,0,0,0],1]
expected: [1,1,2,2,3,3]
Starter codePython
def hrnet_fusion_step(low_res, high_res, weight):
# Your code here
pass4 test cases · run your code against them in the editor