SetValueOperation
Applicable Products
Hardware Model |
Supported |
Remarks |
|---|---|---|
Atlas 350 accelerator cards |
x |
- |
√ |
- |
|
√ |
- |
|
√ |
- |
|
√ |
The bf16 data type is not supported. |
|
√ |
- |
Description
Copies the content of the input source tensor to the specified location of the input target tensor.
The copy is an in-place copy, and the final result is modified in the input target tensor.
Example:
The input target tensor is dst: (a, b, c), and the input source tensor is src: (d, e, f).
dst[starts[0]: ends[0], starts[1]: ends[1], starts[2]: ends[2]] = src
The length of starts[0]:ends[0] is ends[0] - starts[0], the length of starts[1]:ends[1] is ends[1] - starts[1], and the length of starts[2]:ends[2] is ends[2] - starts[2].
Operator Context

Definition
1 2 3 4 5 6 | struct SetValueParam { SVector<int64_t> starts; SVector<int64_t> ends; SVector<int64_t> strides; uint8_t rsv[8] = {0}; }; |
Members
Member |
Type |
Default Value |
Description |
|---|---|---|---|
starts |
SVector<int64_t> |
- |
Start position for copying each dimension. |
ends |
SVector<int64_t> |
- |
One position after the end position of each dimension copy. The copy ends at the previous position of this position. |
strides |
SVector<int64_t> |
- |
Copy step of each dimension. Currently, strides can only be all 1s. |
rsv[8] |
uint8_t |
{0} |
Reserved |
Input
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
dst |
[dim_0, dim_1, ..., dim_n] |
float16/float/int32/int64/bf16 |
ND |
Input tensor 1 |
src |
All dimensions of src are less than or equal to those of dst. |
Same as dst |
ND |
Input tensor 2 |
Output
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
dst |
[dim_0, dim_1, ..., dim_n] |
Same as src |
ND |
Output tensor. Note: The output dst points to the same address as the input with the same name, that is, in-place modification is performed. |
Constraints
- The number of dimensions of input src must be the same as that of input dst.
- The size of each dimension of input src must be less than or equal to that of the corresponding dimension of input dst.
- One or two dimensions of input src and input dst must be different and meet the following requirements:
- If one dimension is different, this dimension cannot be the highest dimension (dimension 0).
- If two dimensions are different, one of the different dimensions must be the highest dimension (dimension 0).
API Calling Example
Input:
starts = {1,2}
ends = {4,4}
strides = {1,1}
dst=[[ 14, -2, 2, -10, -12],
[-11, 3, 2, -18, 6],
[ 1, -18, -12, 9, -6],
[ 16, -11, 6, -6, 3],
[ 12, 18, 14, 10, 9]]
src=[[ 1, 0],
[ -4, 7],
[ 9, -18]]
Output:
dst=[[ 14, -2, 2, -10, -12],
[-11, 3, 1, 0, 6],
[ 1, -18, -4, 7, -6],
[ 16, -11, 9, -18, 3],
[ 12, 18, 14, 10, 9]]