产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
对源操作数中的每个元素进行左移操作。根据源操作数的数据类型,左移操作分为以下两种情况:
1 2 | template <typename T, typename U> __aicore__ inline void ShiftLeft(const LocalTensor<T>& dst, const LocalTensor<T>& src0, const LocalTensor<U>& src1, const int32_t& count) |
参数名 |
描述 |
|---|---|
T |
源/目的操作数数据类型。 Ascend 950PR/Ascend 950DT,支持的数据类型为:int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t。 |
U |
源操作数数据类型。 Ascend 950PR/Ascend 950DT,支持的数据类型为:int8_t、int16_t、int32_t、int64_t。 |
参数名称 |
输入/输出 |
说明 |
|---|---|---|
dst |
输出 |
目的操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 |
src0 |
输入 |
源操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 数据类型需要与目的操作数保持一致。 |
src1 |
输入 |
存放左移位数的LocalTensor,数据类型的字节数需要与源src0操作数Tensor中的元素数据类型的字节数相匹配,不支持设置为负数。 |
count |
输入 |
参与计算的元素个数。 |
无
1 | AscendC::ShiftLeft(dstLocal, srcLocal0, srcLocal1, 512); |
输入数据srcLocal0:[1 2 3 ... 512] 输入数据srcLocal1:[2 2 2 ... 2] 输出数据dstLocal:[4 8 12 ... 2048]