Skip to content
fn

embedding_op

→TensorImplPtr
int embedding_op(const int & weight, const int & indices, int padding_idx, bool scale_grad_by_freq)

Python wrappers

Public Python APIs implemented by this engine symbol.

Integer-index embedding lookup — free-function entry point.

Thin wrapper that delegates to EmbeddingBackward::forward. Used by the pybind11 binding layer and by other C++ call sites.

Parameters

weightTensorImplPtr
Embedding matrix of shape (num_embeddings, embed_dim).
indicesTensorImplPtr
Integer-typed tensor of any shape.
padding_idxint
Index to mask; negative disables masking.

Returns

TensorImplPtr

Output of shape (*indices.shape, embed_dim).