BitwiseAnd
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Performs a bitwise AND operation on two inputs.

Prototype
1 2 | template <const BitwiseAndConfig& config = DEFAULT_BITWISE_AND_CONFIG, typename T> __aicore__ inline void BitwiseAnd(const LocalTensor<T>& dst, const LocalTensor<T>& src0, const LocalTensor<T>& src1, const uint32_t count) |
Parameters
Parameter |
Description |
|---|---|
config |
BitwiseAnd algorithm configuration. This is an optional parameter of the BitwiseAndConfig type. The code below describes the definition. isReuseSource: This parameter is reserved. Pass the default value false. |
T |
Operand data type. 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 BitwiseAndConfig { bool isReuseSource; }; |
Parameter |
Input/Output |
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. The source operand must have the same data type as the destination operand. |
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 operand address alignment requirements, see General Address Alignment Restrictions.
Examples
For details about a complete example, see bitwiseand operator sample.
1 2 3 | AscendC::LocalTensor<uint16_t> dst, src0, src1; uint32_t count = 512; // Number of elements involved in computation AscendC::BitwiseAnd(dst, src0, src1, count); |
1 2 3 4 5 6 | Input (src0): [93, 87, 99, 1, 87, 58, 6, 16, 85, 66, 56, 65, 24, 98, 96, 50, 18, 37, 0, ... 66] Input (src1): [81, 12, 33, 47, 47, 18, 82, 44, 91, 34, 17, 99, 7, 82, 42, 85, 88, 99, 61, ... 81] Output (dst): [81, 4, 33, 1, 7, 18, 2, 0, 81, 2, 16, 65, 0, 66, 32, 16, 16, 33, 0, ... 64] |