IndexAddOperation
Description
Adds a value to a specified index of a fixed dimension.

Definition
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 |
Description |
|---|---|---|---|
indexType |
IndexType |
INDEX_UNDEFINED |
Operation type.
|
axis |
int64_t |
0 |
Axis of the input tensor plus the updates value.
|
rsv[16] |
uint8_t |
{0} |
Reserved |
Input and Output (INDEX_ADD)
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
var |
[d_0, ..., d_n] |
float16 |
ND |
Input tensor. Augend. The input is zero to which addened is added in place as the output. |
indices |
[d_x] |
int32 |
ND |
Input tensor. Specified index of a fixed dimension. d_min = min(d_x, d_axis). The value range is [0, d_min). The first d_min values must be unique. |
updates |
[d_0, ..., d_n] |
float16 |
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 of the axis index is d_x, that is, d_axis = = d_x. |
alpha |
[1] |
float16 |
ND |
Input tensor. Accumulation times. |
output |
[d_0, ..., d_n] |
float16 |
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. d_axis indicates the size of var, updates, and output in the dimension whose index is axis. That is, if axis is 0, d_axis corresponds to the size d_0 of the 0th dimension. |
||||
Input and Output (INDEX_ADD_VALID)
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
var |
[d_1, d_2] |
float16 |
ND |
Input tensor. Augend. The input is zero to which addened is added in place as the output. |
indices |
[d_0] |
int32 |
ND |
Input tensor. Specified index of a fixed dimension. Specified index of a fixed dimension. The value range is [0, d_1). |
updates |
[d_0, d_2] |
float16 |
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, d_0]. |
output |
[d_1, d_2] |
float16 |
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 d_2 is (0, 8192]. |
||||
API Calling Example
- indexType = INDEX_ADD
- indexType = INDEX_ADD_VALID