Skip to content
DeepForgeby svx
All problems
MediumNLPnlp-374

Max Pooling over Token Embeddings

Problem

Max pooling over a sequence of word vectors takes the coordinatewise maximum.

Given the list of vectors, return the pooled vector.

Hint

Reduce each coordinate independently.

Test cases

case 1
in: [[[1,5],[3,2]]]
expected: [3,5]
case 2
in: [[[0,-1],[-2,0]]]
expected: [0,0]
case 3
in: [[[1,1],[1,1],[1,1]]]
expected: [1,1]
Starter codePython
def max_pooling_over_token_embeddings(vectors):
    # Your code here
    pass

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