目录

FreeTensor

Function Description

Releases a specified tensor in a queue for subsequent use.

Function Prototype

template <typename T> 
__aicore__ inline void FreeTensor(LocalTensor<T>& tensor)

Parameters

Parameter Input/Output Description
tensor Input Tensor to be released.

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

Precautions

None

Return Value

None

Calling Example

// Use FreeTensor to release the tensors allocated by AllocTensor. Note that FreeTensor needs to be used together with AllocTensor.
AscendC::TPipe pipe;
AscendC::TQueBind<AscendC::TPosition::VECOUT, AscendC::TPosition::GM, 2> que;
int num = 4;
int len = 1024;
pipe.InitBuffer(que, num, len);
AscendC::LocalTensor<half> tensor1 = que.AllocTensor<half>();
que.FreeTensor<half>(tensor1);