BitwiseNot
产品支持情况
产品 |
是否支持 |
|---|---|
Atlas 350 加速卡 |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
功能说明
逐比特对输入进行取反。

函数原型
1 2 | template <const BitwiseNotConfig& config = DEFAULT_BITWISE_NOT_CONFIG, typename T> __aicore__ inline void BitwiseNot(const LocalTensor<T>& dst, const LocalTensor<T>& src, const uint32_t count) |
参数说明
参数名 |
描述 |
|---|---|
config |
BitwiseNot算法的相关配置。此参数可选配,BitwiseNotConfig类型,具体定义如下方代码所示,其中参数的含义为: isReuseSource:该参数预留,传入默认值false即可。 |
T |
源操作数、目的操作数数据类型。 Atlas 350 加速卡,支持的数据类型为:int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t。 |
1 2 3 | struct BitwiseNotConfig { bool isReuseSource; }; |
参数名称 |
类型 |
说明 |
|---|---|---|
dst |
输出 |
目的操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 |
src |
输入 |
源操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 数据类型需要与目的操作数保持一致。 |
count |
输入 |
参与计算的元素个数。 |
返回值说明
无
约束说明
- 不支持源操作数与目的操作数地址重叠。
- 操作数地址偏移对齐要求请参见通用说明和约束。
调用示例
完整样例请参考bitwisenot算子样例。
1 2 3 | AscendC::LocalTensor<uint32_t> dst, src; uint32_t count = 512; // 参与计算的元素个数 AscendC::BitwiseNot(dst, src, 512); |
结果示例如下:
1 2 3 4 | 输入数据(src): [ 91, 48, -71, 112, 64, -107, 74, -121, -103, -50, 112, -23, 15, ... -74] 输出数据(dst): [-92, -49, 70, -113, -65, 106, -75, 120, 102, 49, -113, 22, -16, ... 73] |
父主题: BitwiseNot接口