LogicalXor
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Performs the logical exclusive OR operation by element. 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 LogicalXorConfig& config = DEFAULT_LOGICAL_XOR_CONFIG, typename T, typename U> __aicore__ inline void LogicalXor(const LocalTensor<T>& dst, const LocalTensor<U>& src0, const LocalTensor<U>& src1, const uint32_t count) |
Parameters
Parameter |
Description |
|---|---|
config |
LogicalXor algorithm configuration. This is an optional parameter of the LogicalXorConfig 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 LogicalXorConfig { bool isReuseSource; }; |
Parameter |
Type |
Description |
|---|---|---|
dst |
Output |
Destination operand. The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT. |
src0, src1 |
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
- 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
1 2 3 4 | AscendC::LocalTensor<uint32_t> src0, src1; AscendC::LocalTensor<bool> dst; uint32_t count = 512; // Number of elements involved in computation AscendC::LogicalXor(dst, src0, src1, count); |
Result example:
1 2 3 4 5 6 | Input (src0): [-4, 4, 1, -8, 0, ... 3] Input (src1): [-1, 3, 1, 5, 1, ... -3] Output (dst): [False, False, False, False, True, ... False] |