Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-173

Patch Position Ids

Problem

Build a 2D grid of patch position ids.

Return a num_patches_h x num_patches_w grid where cell (i, j) holds i * num_patches_w + j.

Test cases

case 1
in: [2,2]
expected: [[0,1],[2,3]]
case 2
in: [1,3]
expected: [[0,1,2]]
case 3
in: [2,1]
expected: [[0],[1]]
case 4
in: [1,1]
expected: [[0]]
Starter codePython
def position_ids(num_patches_h, num_patches_w):
    # Your code here
    pass

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