目录

GetTensorCountInQue

Function Description

Queries the number of enqueued tensors in a queue.

Function Prototype

__aicore__ inline int32_t GetTensorCountInQue()

Parameters

None

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

Precautions

None

Return Value

Number of enqueued tensors in the queue

Calling Example

// Call GetTensorCountInQue to query the number of enqueued tensors in the queue. Currently, AllocTensor is called to allocate memory and add the memory to the queue. The value of num is 1.
AscendC::TPipe pipe;
AscendC::TQueBind<AscendC::TPosition::VECOUT, AscendC::TPosition::GM, 4> que;
int num = 4;
int len = 1024;
pipe.InitBuffer(que, num, len);
AscendC::LocalTensor<half> tensor1 = que.AllocTensor<half>();
que.EnQue(tensor1);// Add the tensor to the queue of VECOUT.
int32_t numb = que.GetTensorCountInQue();