Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-307

Patch Embedding Dimension

Problem

Compute the projection dimension of a convolutional patch embedding.

A patch of patch_h x patch_w pixels from an image with in_channels channels flattens to patch_h * patch_w * in_channels values. Return that dimension.

Test cases

case 1
in: [16,16,3]
expected: 768
case 2
in: [14,14,1]
expected: 196
case 3
in: [8,8,3]
expected: 192
case 4
in: [4,4,64]
expected: 1024
Starter codePython
def patch_embed_dim(patch_h, patch_w, in_channels):
    # Your code here
    pass

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