We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Medium
End-to-End
Word Embedding Model
Implement a simple word embedding lookup followed by average pooling.
Given a vocabulary embedding table and a sequence of word indices:
- Look up each word’s embedding vector from the table
- Average all embedding vectors to get a single representation
Input:
-
embedding_table: shape(vocab_size, embed_dim)— the embedding matrix -
indices: shape(seq_len,)— integer word indices
Output: The averaged embedding vector of shape (embed_dim,).
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.