Versioned name: Gather-1
Category: Data movement operations
Short description: Gather operation takes slices of data in the 1st input tensor according to the indexes specified in the 2nd input tensor and axis from the 3rd input
Detailed description
output[:, ... ,:, i, ... , j,:, ... ,:] = input1[:, ... ,:, input2[i, ... ,j],:, ... ,:]
Where i is value from the 3rd input.
Attributes: Gather has no attributes
Inputs
- 1: Tensor with arbitrary data. Required.
- 2: Tensor with indexes to gather. The values for indexes are in the range
[0, input1[axis] - 1]
. Required.
- 3: Scalar or 1D tensor axis is a dimension index to gather data from. For example, axis equal to 1 means that gathering is performed over the first dimension. Negative value means reverse indexing. Allowed values are from
[-len(input1.shape), len(input1.shape) - 1]
. Required.
Outputs
- 1: The resulting tensor that consists of elements from 2nd input tensor gathered by indices from 1st input tensor. Shape of the tensor is
input1.shape[:axis] + input2.shape + input1.shape[axis + 1:]
Example
<layer id="1" type="Gather" ...>
<input>
<port id="0">
<dim>6</dim>
<dim>12</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="1">
<dim>15</dim>
<dim>4</dim>
<dim>20</dim>
<dim>28</dim>
</port>
<port id="2"/>
</input>
<output>
<port id="2">
<dim>6</dim>
<dim>15</dim>
<dim>4</dim>
<dim>20</dim>
<dim>28</dim>
<dim>10</dim>
<dim>24</dim>
</port>
</output>
</layer>