GetUserTag

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

Atlas training product

Function Usage

Obtains the tag information of a specified tensor block. You can perform different operations on tensors based on the tag information.

Prototype

1
__aicore__ inline TTagType GetUserTag() const

Parameters

None

Returns

Tag information of a specified tensor block. TTagType is defined as follows:

1
using TTagType = int32_t

Restrictions

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// Example
AscendC::LocalTensor<half> tensor1 = que1.DeQue<half>();
AscendC::TTagType tag1 = tensor1.GetUserTag();
AscendC::LocalTensor<half> tensor2 = que2.DeQue<half>();
AscendC::TTagType tag2 = tensor2.GetUserTag();
AscendC::LocalTensor<half> tensor3 = que3.AllocTensor<half>();
/* Use tags to control the execution of conditional statements.*/
if ((tag1 <= 10) && (tag2 >= 9)) {
    AscendC::Add(tensor3, tensor1, tensor2, TILE_LENGTH); // The addition operation can be performed only when tag1 is less than or equal to 10 and tag2 is greater than or equal to 9.
}