FunctionRacerProblemsRace

Average the Embeddings

HardPyTorchPython

table has one row per word: its vector. ids has one row per sentence, holding the numbers of its words. Return one vector per sentence: the mean of the vectors of its words.

Example 1

table [[1.0,0.0],[0.0,1.0],[2.0,2.0]]
ids [[0,1],[2,2]]
returns [[0.5,0.5],[2.0,2.0]]

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More PyTorch problems