EmbeddingBagOffsetsSum

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:

Outputs:

Types

Example

<layer ... type="EmbeddingBagOffsetsSum" ... >
<input>
<port id="0">
<dim>5</dim>
<dim>2</dim>
</port>
<port id="1">
<dim>4</dim>
</port>
<port id="2">
<dim>3</dim>
</port>
<port id="3"/>
<port id="4"/>
<dim>4</dim>
</port>
</input>
<output>
<port id="5">
<dim>3</dim>
<dim>2</dim>
</port>
</output>
</layer>