BitwiseNot

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Performs a bitwise NOT operation on the input.

Prototype

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)

Parameters

Table 1 Template parameters

Parameter

Description

config

BitwiseNot algorithm configuration. This is an optional parameter of the BitwiseNotConfig type. The code below describes the definition.

isReuseSource: This parameter is reserved. Pass the default value false.

T

Data type of the source and destination operands.

For the Atlas 350 Accelerator Card, the supported data types are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, and uint64_t.

1
2
3
struct BitwiseNotConfig {
    bool isReuseSource;
};
Table 2 Parameters

Parameter

Type

Description

dst

Output

Destination operand.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

src

Input

Source operand.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

The source and destination operands must have the same data type.

count

Input

Number of elements involved in the computation.

Returns

None

Constraints

  • The source operand address must not overlap the destination operand address.
  • For details about the alignment requirements of the operand address offset, see General Description and Restrictions.

Examples

For details about a complete example, see bitwisenot operator sample.
1
2
3
AscendC::LocalTensor<uint32_t> dst, src;
uint32_t count = 512; // Number of elements involved in computation
AscendC::BitwiseNot(dst, src, 512);

Result example:

1
2
3
4
Input (src):
[ 91, 48, -71, 112, 64, -107, 74, -121, -103, -50, 112, -23, 15, ... -74]
Output (dst):
[-92, -49, 70, -113, -65, 106, -75, 120, 102, 49, -113, 22, -16, ... 73]