LogicalNot

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

Applies a logical NOT operation element-wise. If the input data type is not bool, zero is regarded as False, and non-zero data is regarded as True.

Prototype

1
2
template <const LogicalNotConfig& config = DEFAULT_LOGICAL_NOT_CONFIG, typename T, typename U>
__aicore__ inline void LogicalNot(const LocalTensor<T>& dst, const LocalTensor<U>& src, const uint32_t count)

Parameters

Table 1 Template parameters

Parameter

Description

config

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

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

T

Data type of the destination operand.

For the Atlas 350 Accelerator Card, the supported data type is bool.

U

Data type of the source operand.

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

1
2
3
struct LogicalNotConfig {
    bool isReuseSource;
};
Table 2 API parameters

Parameter

Input/Output

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.

count

Input

Number of elements involved in the computation.

Returns

None

Constraints

Examples

For details about a complete example, see logicalnot operator sample.

1
2
3
4
AscendC::LocalTensor<bool> dst;
AscendC::LocalTensor<half> src;
uint32_t count = 512; // Number of elements involved in computation
AscendC::LogicalNot(dst, src, count); 
Result example:
1
2
3
4
5
Input (src):
[1, 2, 0, -1, -2, 0, 3, 4, 0, -3, -4, 0, 5, 6, 0, -5, -6, 0, ... 0]
Output (dst):
[False, False, True, False, False, True, False, False, True, False,
 False, True, False, False, True, False, False, True, ... True]