SetSize

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product AI Core

Atlas inference product Vector Core

Atlas training product

Function Usage

Sets the size of the current LocalTensor. The unit is element. When the LocalTensor is reused and its length changes, you need to call this API to reset the size.

Prototype

1
__aicore__ inline void SetSize(const uint32_t size)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

size

Input

Number of elements.

Returns

None

Restrictions

None

Examples

// Example 1: Use SetSize to change the length of the requested tensor to 256 (unit: element).
AscendC::LocalTensor<float> tmpBuffer3 = tempBmm2Queue.AllocTensor<float>();
tmpBuffer3.SetSize(256);