easy primitives

Implement Embedding Lookup

Implement an embedding lookup operation.

Given a weight matrix (embedding table) and a list of indices, return the corresponding embedding vectors.

Input:

  • weight: embedding matrix of shape (vocab_size, embed_dim)
  • indices: 1D integer tensor of shape (seq_len,)

Output: Tensor of shape (seq_len, embed_dim) with the looked-up embeddings

Hints

embedding nlp basics
Detecting runtime...