Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-227

Class Token Output

Problem

Extract the class token from a sequence of token embeddings.

Return the first token as a list, or [] when the sequence is empty.

Test cases

case 1
in: [[[1,2],[3,4],[5,6]]]
expected: [1,2]
case 2
in: [[]]
expected: []
case 3
in: [[[7,8]]]
expected: [7,8]
Starter codePython
def class_token(tokens):
    # Your code here
    pass

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