Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-174

ViT CLS Concat

Problem

Prepend a CLS token to a sequence of patch embeddings.

Return [cls_token] + patches, converting every entry to a list. An empty patch list returns just the CLS token.

Test cases

case 1
in: [[[1,2],[3,4]],[9,9]]
expected: [[9,9],[1,2],[3,4]]
case 2
in: [[[5]],[0]]
expected: [[0],[5]]
case 3
in: [[],[7,7]]
expected: [[7,7]]
Starter codePython
def prepend_cls(patches, cls_token):
    # Your code here
    pass

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