产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
按元素进行取相反数操作,计算公式如下:

1 2 | template <typename T> __aicore__ inline void Neg(const LocalTensor<T>& dst, const LocalTensor<T>& src, const uint32_t count) |
参数名 |
描述 |
|---|---|
T |
操作数数据类型。 Ascend 950PR/Ascend 950DT,支持的数据类型为:int8_t/int16_t/half/int32_t/float/int64_t |
参数名 |
输入/输出 |
描述 |
|---|---|---|
dst |
输出 |
目的操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 |
src |
输入 |
源操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 源操作数的数据类型需要与目的操作数保持一致。 |
count |
输入 |
参与计算的元素个数。 |
无
更多样例可参考LINK。
1 | AscendC::Neg(dstLocal, srcLocal, 512); |
1 2 | 输入数据(srcLocal): [1 2 3 4 ...] 输出数据(dstLocal): [-1 -2 -3 -4 ...] |