SetValue

Product Support

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product's AI Core

Atlas inference product's Vector Core

Atlas training products

Function

Sets a value in the LocalTensor.

This API is supported only when the TPosition of the LocalTensor is VECIN, VECCALC, or VECOUT.

Prototype

1
2
template <typename T1> __aicore__ inline __inout_pipe__(S)
void SetValue(const uint32_t index, const T1 value) const

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

index

Input

LocalTensor index. The unit is element.

value

Input

Value to be set.

Returns

None

Restrictions

Do not use SetValue to assign values to the LocalTensor frequently. Otherwise, the performance deteriorates. If a large number of values need to be assigned, select basic APIs for data padding or high-level APIs for data padding (Pad and Broadcast) based on the actual situation. If incremental sequences need to be generated, select Arange.

Example

For details, see Example.