---
title: BitwiseNot
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendcopapi/atlasascendc_api_07_10265.html
sourcePath: /source/zh/canncommercial/900/API/ascendcopapi/atlasascendc_api_07_10265.html
indexId: 211e5c0357a1b3d9ea5f0b836159cf0c64b6aab137a40ceac581a54a2c06a20677
---
# BitwiseNot

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | x |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | x |
| Atlas 200I/500 A2 推理产品 | x |
| Atlas 推理系列产品 AI Core | x |
| Atlas 推理系列产品 Vector Core | x |
| Atlas 训练系列产品 | x |


#### 功能说明

逐比特对输入进行取反。


#### 函数原型

```
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)
```


#### 参数说明


**表1 模板参数说明**

| 参数名 | 描述 |
| --- | --- |
| config | BitwiseNot算法的相关配置。此参数可选配，BitwiseNotConfig类型，具体定义如下方代码所示，其中参数的含义为： isReuseSource：该参数预留，传入默认值false即可。 |
| T | 源操作数、目的操作数数据类型。 Atlas 350 加速卡，支持的数据类型为：int8\_t、uint8\_t、int16\_t、uint16\_t、int32\_t、uint32\_t、int64\_t、uint64\_t。 |


```
struct BitwiseNotConfig {
    bool isReuseSource;
};
```


**表2 参数说明**

| 参数名称 | 类型 | 说明 |
| --- | --- | --- |
| dst | 输出 | 目的操作数。 类型为LocalTensor，支持的TPosition为VECIN/VECCALC/VECOUT。 |
| src | 输入 | 源操作数。 类型为LocalTensor，支持的TPosition为VECIN/VECCALC/VECOUT。 数据类型需要与目的操作数保持一致。 |
| count | 输入 | 参与计算的元素个数。 |


#### 返回值说明

无


#### 约束说明

- 不支持源操作数与目的操作数地址重叠。
- 操作数地址偏移对齐要求请参见  通用说明和约束
。


#### 调用示例

完整样例请参考bitwisenot算子样例(https://gitcode.com/cann/asc-devkit/tree/9.0.0/examples/01_simd_cpp_api/03_libraries/12_math/bitwisenot)。```
AscendC::LocalTensor<uint32_t> dst, src;
uint32_t count = 512; // 参与计算的元素个数
AscendC::BitwiseNot(dst, src, 512);
```


结果示例如下：

```
输入数据（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]
```
