GetTensorCountInQue

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

x

Atlas training product

Function Usage

Queries the number of enqueued tensors in a queue.

Prototype

1
__aicore__ inline int32_t GetTensorCountInQue()

Parameters

None

Constraints

This API does not support inplace tensor operations. This means depth of TQue is set to 0.

Returns

Number of enqueued tensors in the queue

Example

1
2
3
4
5
6
7
8
9
// 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();