.. _l-onnx-doc-BitwiseAnd: ========== BitwiseAnd ========== .. contents:: :local: .. _l-onnx-op-bitwiseand-18: BitwiseAnd - 18 =============== **Version** * **name**: `BitwiseAnd (GitHub) `_ * **domain**: **main** * **since_version**: **18** * **function**: False * **support_level**: SupportType.COMMON * **shape inference**: True This version of the operator has been available **since version 18**. **Summary** Returns the tensor resulting from performing the bitwise `and` operation elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX `_. **Inputs** * **A** (heterogeneous) - **T**: First input operand for the bitwise operator. * **B** (heterogeneous) - **T**: Second input operand for the bitwise operator. **Outputs** * **C** (heterogeneous) - **T**: Result tensor. **Type Constraints** * **T** in ( tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input to integer tensors. **Examples** **default** :: node = onnx.helper.make_node( "BitwiseAnd", inputs=["x", "y"], outputs=["bitwiseand"], ) # 2d x = np.random.randn(3, 4).astype(np.int32) y = np.random.randn(3, 4).astype(np.int32) z = np.bitwise_and(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_bitwise_and_i32_2d") # 3d x = np.random.randn(3, 4, 5).astype(np.int16) y = np.random.randn(3, 4, 5).astype(np.int16) z = np.bitwise_and(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_bitwise_and_i16_3d") **_bitwiseand_broadcast** :: node = onnx.helper.make_node( "BitwiseAnd", inputs=["x", "y"], outputs=["bitwiseand"], ) # 3d vs 1d x = np.random.randn(3, 4, 5).astype(np.uint64) y = np.random.randn(5).astype(np.uint64) z = np.bitwise_and(x, y) expect( node, inputs=[x, y], outputs=[z], name="test_bitwise_and_ui64_bcast_3v1d" ) # 4d vs 3d x = np.random.randn(3, 4, 5, 6).astype(np.uint8) y = np.random.randn(4, 5, 6).astype(np.uint8) z = np.bitwise_and(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_bitwise_and_ui8_bcast_4v3d")