// 为TBuf初始化分配内存,分配内存长度为1024Bytes AscendC::TPipe pipe; AscendC::TBuf<AscendC::TPosition::VECCALC> calcBuf; // 模板参数为TPosition中的VECCALC类型 uint32_t byteLen = 1024; pipe.InitBuffer(calcBuf, byteLen); // 从calcBuf偏移64字节获取Tensor,Tensor为128个int32_t类型元素的内存大小,为512Bytes AscendC::LocalTensor<int32_t> tempTensor1 = calcBuf.GetWithOffset<int32_t>(128, 64);