IndexAddOperation
Applicable Products
Hardware Model |
Supported |
|---|---|
Atlas 350 accelerator cards |
x |
√ |
|
√ |
|
x |
|
x |
|
x |
Description
Adds a value to a specified index of a fixed dimension.

Definition
1 2 3 4 5 6 7 8 9 10 | struct IndexAddParam { enum IndexType { INDEX_UNDEFINED = 0, INDEX_ADD, INDEX_ADD_VALID }; IndexType indexType = INDEX_UNDEFINED; int64_t axis = 0; uint8_t rsv[16] = {0}; }; |
Parameters
Member |
Type |
Default Value |
Value Range |
Mandatory |
Description |
|---|---|---|---|---|---|
indexType |
IndexType |
INDEX_UNDEFINED |
0, 1, 2 |
Yes |
Operation type. |
axis |
int64_t |
0 |
|
No |
Axis of the input tensor plus the updates value.
|
rsv[16] |
uint8_t |
{0} |
[0] |
No |
Reserved |
Input and Output (INDEX_ADD)
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
var |
[dim_0, ..., dim_n] |
float16/bf16 |
ND |
Input tensor. Augend. The input is zero to which addened is added in place as the output. |
indices |
[dim_x] |
int32 |
ND |
Input tensor. Specified index of a fixed dimension. dim_min = min(dim_x, dim_axis) (dim_axis of var). The value range is [0, dim_min). The first dim_min values must be unique. |
updates |
[dim_0, ..., dim_n] |
float16/bf16 |
ND |
Input tensor. Addend, which is added to var based on the value of indices. The number of dimensions is the same as that of var. The dimension with the index axis is dim_x, that is, dim_axis = dim_x (dim_axis of updates, which may be different from that of var). |
alpha |
[1] |
float16/bf16 |
ND |
Input tensor. Accumulation times. |
output |
[dim_0, ..., dim_n] |
float16/bf16 |
ND |
Output tensor. It is the same as var. That is, they have the same attributes, such as the data type, data format, and address. |
min(x, y) indicates that the smaller value between x and y is used. dim_axis indicates the size of var, updates, and output in the dimension whose index is axis. That is, if axis is 0, dim_axis corresponds to the size d_0 of the 0th dimension. |
||||
Input and Output (INDEX_ADD_VALID)
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
var |
[dim_1, dim_2] |
float16/bf16 |
ND |
Input tensor. Augend. The input is zero to which addened is added in place as the output. |
indices |
[dim_0] |
int32 |
ND |
Input tensor. Specified index of a fixed dimension. The value range is [0, dim_1). |
updates |
[dim_0, dim_2] |
float16/bf16 |
ND |
Input tensor. Addend, which is added to var based on the value of indices. |
validIndicesNum |
[1] |
int32 |
ND |
Input tensor. Valid length of indices. The value range is [0, dim_0]. |
output |
[dim_1, dim_2] |
float16/bf16 |
ND |
Output tensor. It is the same as var. That is, they have the same attributes, such as the data type, data format, and address. |
The value range of dim_2 is (0, 8192]. |
||||
API Calling Example
- indexType = INDEX_ADD
- indexType = INDEX_ADD_VALID