InferenceAI

Enter at least two characters to search.

Start free

Mean Pool Token Embeddings

mediumEmbeddings20 min25 XP

Return the column-wise mean of a matrix of token embeddings. Return [] for empty input.

Examples

EXAMPLE WALKTHROUGHtwo vectors

A guided view of the published example, not a trace of your code.

INPUT[[[1,2],[3,4]]]
TASKmean_pool()
EXPECTED OUTPUT[2,3]

Start with the input values shown in this example.

Example 1 of 2

Input: vectors = [[1,2],[3,4]]

Output: [2,3]

Explanation: two vectors

Input: vectors = []

Output: []

Explanation: empty

Hint 1

Average each dimension independently.

Topics

PythonEmbeddings