| ag_embedding | R Documentation |
Maps 0-based integer indices to dense vectors via table lookup.
Input: integer matrix or vector of 0-based indices.
Output: float tensor [dim, length(idx)].
ag_embedding(vocab_size, dim)
vocab_size |
Vocabulary size |
dim |
Embedding dimension |
Backward: scatter-add — only the looked-up rows accumulate gradient.
An ag_embedding environment
emb <- ag_embedding(100L, 16L)
idx <- c(0L, 3L, 7L, 2L)
out <- emb$forward(idx) # [16, 4]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.