产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
获取指定Tensor块的Tag信息,用户可以根据Tag信息对Tensor进行不同操作。
1 | __aicore__ inline TTagType GetUserTag() const |
无
指定Tensor块的Tag信息。TTagType定义如下:
1 | using TTagType = int32_t |
无
1 2 3 4 5 6 7 8 9 10 | // 示例8 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>(); /* 使用Tag控制条件语句执行*/ if ((tag1 <= 10) && (tag2 >= 9)) { AscendC::Add(tensor3, tensor1, tensor2, TILE_LENGTH); // 当tag1小于等于10,tag2大于等于9的时候,才能进行相加操作。 } |