Allocates tensors from the queue. The size occupied by tensors is the length of each buffer configured when InitBuffer is used.
The allocated tensor content cannot all be 0. The content may be a random value.
Kirin 9020 series processors
Kirin 9030 series processors
Kirin X90 series processors
// Use AllocTensor to allocate tensors. AscendC::TPipe pipe; AscendC::TQueBind<AscendC::TPosition::VECOUT, AscendC::TPosition::GM, 2> que; int num = 4; int len = 1024; pipe.InitBuffer(que, num, len); // Four buffers are allocated by InitBuffer, and the size of each buffer is 1,024 bytes. AscendC::LocalTensor<half> tensor1 = que.AllocTensor<half>(); // The length of the tensor allocated by AllocTensor is 1,024 bytes.