Versioned name: EmbeddingBagOffsetsSum-3
Category: Sparse
Short description: Computes sums of "bags" of embeddings, without instantiating the intermediate embeddings.
Detailed description: This is the second case of the PyTorch EmbeddingBag, it has indices in two 1D tensors provided as 2nd and 3rd inputs. For each index in indices
this operator gets values from data
embedding table and sums all values belonging to each bag. Values in offsets
define starting index in indices
tensor of each "bag", e.g. offsets
with value [0,3,4,4,6]
define 5 "bags" containing [3,1,0,2,n-6]
elements.
Inputs:
emb_table
tensor containing the embedding lookup table of the module of shape [num_emb, emb_dim1, emb_dim2, ...]
and of type T. Required.indices
tensor of shape [num_indices]
and of type T_IND. Required.offsets
tensor of shape [batch]
and of type T_IND containing the starting index positions of each "bag" in indices
. Required.default_index
scalar of type T_IND containing default index in embedding table to fill empty "bags". If not provided empty "bags" are filled with zeros. Optional.per_sample_weights
tensor of the same shape as indices
and of type T. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones.Outputs:
[batch, emb_dim1, emb_dim2, ...]
and of type T containing embeddings for each bag.Types
int32
or int64
.Example