Difficulty: Easy Tags: Transformers
An Azure Cognitive Services text pipeline needs the single most basic operation in any transformer: turning token ids into vectors via table lookup, before any positional encoding or attention touches them.
Given embedding matrix E of shape (V, d) and a sequence of token ids, return E[ids].
V d
E (V x d, row-major)
n
id_1 ... id_n
n x d matrix, one row per token, 6 decimals.
1 <= V <= 10^5, 1 <= d <= 512, 1 <= n <= 10^4, ids in [0, V-1]Input
4 2
0.1 0.2
0.3 0.4
0.5 0.6
0.7 0.8
3
2 0 3
Output
0.500000 0.600000
0.100000 0.200000
0.700000 0.800000
No results yet
Run your code to check it against the examples, or submit to run every test.