Average the Embeddings
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
- 2 to 6 words in the table, vectors of 1 to 3 numbers
- 1 to 4 sentences, all of the same length, 1 to 4 words
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.