BitwiseAnd
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | √ |
| Atlas training products | √ |
Function Description
-
Operator function: computes the bitwise AND of each element in the input tensor and the corresponding element of the other input (a tensor or a scalar). The inputs must be integer or BOOL variables. When the inputs are BOOL, the logical AND result is computed.
-
Computation formula:
-
When other is a tensor:
outi=selfi&otheriout_i = self_i \& other_i
-
When other is a scalar:
outi=selfi&otherout_i = self_i \& other
-
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| self | Input | Input self in the formula. | INT16, UINT16, INT32, INT64, INT8, UINT8, UINT32, UINT64, BOOL | ND |
| other | Input | Input other in the formula. | INT16, UINT16, INT32, INT64, INT8, UINT8, UINT32, UINT64, BOOL | ND |
| out | Output | Output out in the formula. | BOOL, INT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, UINT8, FLOAT, FLOAT16, DOUBLE, BFLOAT16, COMPLEX64, COMPLEX128 | ND |
- Atlas A3 products, Atlas A2 products, Atlas inference products, and Atlas training products: the data types of self and other do not support UINT32 or UINT64; the data type of out does not support UINT32, UINT64, COMPLEX64, or COMPLEX128.
Constraint Description
- The data types of the inputs must satisfy the data type deduction rules (see deduction relationship), and the deduced data types must be within the supported range.
- Each API is deterministic by default. For specific constraints, refer to the corresponding aclnn API documentation.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| aclnn API | test_aclnn_bitwise_and_scalar.cpp | Invokes the BitwiseAndScalar operator through the aclnnBitwiseAndScalar API. |
| aclnn API | test_aclnn_bitwise_and_tensor.cpp | Invokes the BitwiseAndTensor operator through the aclnnBitwiseAndTensor API. |
| aclnn API | test_aclnn_bitwise_and_tensor_out.cpp | Invokes the BitwiseAndTensorOut operator through the aclnnBitwiseAndTensorOut API. |
| aclnn API | test_aclnn_inplace_bitwise_and_tensor_out.cpp | Invokes the InplaceBitwiseAndTensorOut operator through the aclnnInplaceBitwiseAndTensorOut API. |
| aclnn API | test_aclnn_inplace_bitwise_and_scalar.cpp | Invokes the InplaceBitwiseAndScalar operator through the aclnnInplaceBitwiseAndScalar API. |
| aclnn API | test_aclnn_inplace_bitwise_and_tensor.cpp | Invokes the InplaceBitwiseAndTensor operator through the aclnnInplaceBitwiseAndTensor API. |