SetAddrWithOffset
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Sets the tensor address with an offset. It is used to quickly obtain and define a tensor and specify the offset of the new tensor relative to the start address of the old tensor. The offset length is the number of elements of the old tensor.
Prototype
1 2 | template <typename S> __aicore__ inline void SetAddrWithOffset(LocalTensor<S> &src, uint32_t offset) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
src |
Input |
Base address tensor. The address of this tensor is used as the base address, and the offset is applied to obtain the new tensor address. |
offset |
Input |
Offset length, in elements. |
Returns
None
Restrictions
None
Examples
1 2 3 4 5 | // Example: Use SetAddrWithOffset to obtain and define a tensor and specify the offset of the new tensor relative to the start address of the old tensor. // Note that the offset length is the number of elements of the old tensor. AscendC::LocalTensor<float> tmpBuffer1 = tempBmm2Queue.AllocTensor<float>(); AscendC::LocalTensor<half> tmpHalfBuffer; tmpHalfBuffer.SetAddrWithOffset(tmpBuffer1, calcSize * 2); |
Parent topic: LocalTensor