.. _op_ai_onnx_BitwiseXor: BitwiseXor ========== - **Domain**: ``ai.onnx`` - **Since version**: 18 Returns the tensor resulting from performing the bitwise ``BitwiseXor`` operation elementwise on the input tensors ``A`` and ``B`` (with Numpy-style broadcasting support). **Inputs** - **A** (*T*): First input operand for the bitwise operator. - **B** (*T*): Second input operand for the bitwise operator. **Outputs** - **C** (*T*): Result tensor. **Type Constraints** - **T**: Constrain input to integer tensors. Allowed types: tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8). Examples -------- **test_bitwise_xor_i16_3d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4, 5), dtype=int16 [[[ 0, 0, 0, 0, 0], [ 0, -1, 0, 0, 0], [-1, 0, 0, 0, 1], [ 0, 0, 1, 1, 0]], [[ 0, -2, 0, 0, 1], [ 1, 0, 0, 0, 0], [ 0, 0, 0, 0, 0], [ 1, 1, 0, 1, 0]], [[ 0, 0, -1, 1, 1], [ 0, 0, 2, 0, -1], [ 0, 1, -1, 0, -1], [-2, 0, 1, 0, 0]]] y: shape=(3, 4, 5), dtype=int16 [[[ 0, 0, 0, 0, -1], [ 0, 0, 0, -1, 0], [ 0, 0, -1, 1, -2], [-1, 0, 3, 1, 0]], [[ 1, 0, 1, 0, 0], [ 0, 0, 1, 1, 0], [-1, 0, 0, 0, 0], [ 0, 0, 0, 2, 0]], [[-1, 1, 0, 0, 0], [ 0, 1, 1, 0, 0], [ 0, 1, 1, 0, 0], [ 0, 0, 1, 0, 1]]] Outputs: z: shape=(3, 4, 5), dtype=int16 [[[ 0, 0, 0, 0, -1], [ 0, -1, 0, -1, 0], [-1, 0, -1, 1, -1], [-1, 0, 2, 0, 0]], [[ 1, -2, 1, 0, 1], [ 1, 0, 1, 1, 0], [-1, 0, 0, 0, 0], [ 1, 1, 0, 3, 0]], [[-1, 1, -1, 1, 1], [ 0, 1, 3, 0, -1], [ 0, 0, -2, 0, -1], [-2, 0, 0, 0, 1]]] **test_bitwise_xor_i32_2d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4), dtype=int32 [[ 0, 0, 0, 0], [-1, 0, 0, 0], [ 0, 0, 1, -1]] y: shape=(3, 4), dtype=int32 [[-1, 0, 0, 0], [ 2, 0, 2, 0], [ 0, 0, 0, 0]] Outputs: z: shape=(3, 4), dtype=int32 [[-1, 0, 0, 0], [-3, 0, 2, 0], [ 0, 0, 1, -1]] **test_bitwise_xor_ui64_bcast_3v1d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4, 5), dtype=uint64 [[[38592, 57130, 30010, 12220, 63716], [40454, 21000, 18587, 14919, 55713], [51213, 53276, 33979, 15572, 63881], [26187, 64886, 25066, 57470, 17215]], [[16416, 57190, 23824, 18246, 8070], [56972, 428, 22548, 37023, 4691], [43430, 44942, 46590, 43532, 16851], [59010, 3073, 29436, 50283, 58584]], [[10616, 46520, 40388, 45111, 23248], [16643, 47046, 59723, 1244, 29139], [34725, 57503, 50514, 8712, 54399], [42432, 53830, 10805, 22067, 28875]]] y: shape=(5,), dtype=uint64 [32486, 36076, 10935, 60030, 2775] Outputs: z: shape=(3, 4, 5), dtype=uint64 [[[59430, 21446, 24461, 50626, 62003], [57568, 57060, 25132, 53305, 54134], [46827, 23792, 44556, 54954, 62302], [ 6317, 29082, 19293, 2560, 18920]], [[16070, 21386, 30631, 44344, 5457], [41066, 36160, 29347, 31457, 6276], [55104, 9058, 40777, 16498, 19204], [39012, 33005, 22603, 11797, 60943]], [[22430, 14676, 46963, 23113, 20487], [16357, 15146, 50172, 61090, 31492], [63811, 27763, 61413, 51318, 57000], [56102, 24234, 130, 48205, 31260]]] **test_bitwise_xor_ui8_bcast_4v3d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4, 5, 6), dtype=uint8 [[[[103, 112, 250, 101, 212, 9], [241, 0, 233, 197, 220, 110], [ 13, 130, 212, 253, 147, 202], [122, 222, 46, 55, 242, 184], [105, 252, 185, 177, 230, 190]], [[164, 9, 28, 183, 6, 195], [ 94, 97, 199, 56, 33, 245], [148, 28, 209, 71, 98, 188], [ 46, 41, 99, 204, 202, 32], [155, 130, 216, 22, 212, 19]], [[228, 54, 204, 231, 112, 194], [ 91, 205, 90, 73, 180, 65], [225, 103, 129, 114, 77, 15], [255, 24, 38, 170, 31, 175], [117, 134, 63, 71, 203, 174]], [[104, 31, 17, 173, 161, 199], [ 79, 176, 16, 11, 59, 76], [ 62, 73, 181, 176, 115, 138], [ 59, 81, 142, 1, 88, 204], [ 26, 138, 27, 141, 71, 27]]], [[[ 21, 112, 215, 191, 82, 83], [150, 159, 94, 101, 43, 231], [ 85, 17, 69, 149, 222, 195], [ 2, 149, 214, 26, 250, 126], [205, 110, 11, 218, 232, 180]], [[196, 182, 43, 93, 71, 225], [201, 47, 3, 128, 93, 59], [167, 18, 133, 140, 235, 136], [ 31, 250, 152, 59, 222, 87], [103, 55, 87, 38, 185, 86]], [[195, 48, 46, 50, 113, 2], [174, 67, 22, 1, 67, 18], [ 87, 46, 64, 58, 77, 255], [109, 110, 183, 218, 86, 102], [124, 145, 222, 204, 236, 151]], [[224, 14, 37, 95, 106, 246], [ 76, 245, 160, 159, 251, 179], [ 2, 47, 38, 48, 32, 5], [152, 148, 82, 193, 66, 185], [ 56, 246, 156, 207, 87, 158]]], [[[203, 164, 66, 255, 246, 223], [158, 190, 243, 44, 252, 2], [236, 215, 141, 47, 66, 81], [137, 84, 2, 105, 176, 243], [ 54, 209, 239, 168, 158, 163]], [[ 8, 180, 153, 107, 132, 50], [219, 5, 10, 192, 207, 179], [106, 36, 99, 205, 3, 59], [ 30, 68, 9, 218, 56, 97], [139, 188, 251, 101, 122, 157]], [[107, 225, 99, 200, 182, 120], [172, 100, 161, 91, 44, 156], [142, 48, 188, 198, 18, 77], [242, 125, 120, 151, 138, 158], [165, 223, 217, 101, 44, 151]], [[ 79, 14, 236, 71, 19, 5], [136, 252, 170, 57, 209, 66], [145, 186, 223, 58, 232, 23], [147, 23, 204, 60, 128, 94], [ 92, 253, 156, 189, 112, 251]]]] y: shape=(4, 5, 6), dtype=uint8 [[[170, 83, 0, 168, 177, 132], [135, 247, 250, 113, 139, 8], [210, 116, 109, 93, 133, 128], [128, 157, 157, 240, 229, 17], [144, 206, 81, 55, 135, 15]], [[ 10, 151, 181, 25, 206, 145], [ 38, 215, 110, 39, 6, 159], [ 61, 23, 172, 187, 148, 16], [ 74, 194, 22, 80, 91, 68], [241, 110, 147, 9, 157, 43]], [[ 17, 180, 112, 158, 180, 207], [ 57, 120, 224, 232, 37, 13], [ 83, 211, 224, 224, 249, 155], [185, 201, 172, 131, 39, 189], [180, 242, 80, 193, 12, 203]], [[254, 105, 136, 90, 38, 9], [215, 229, 166, 57, 47, 74], [ 58, 28, 169, 28, 210, 117], [ 19, 214, 161, 50, 123, 206], [ 37, 106, 22, 223, 144, 207]]] Outputs: z: shape=(3, 4, 5, 6), dtype=uint8 [[[[205, 35, 250, 205, 101, 141], [118, 247, 19, 180, 87, 102], [223, 246, 185, 160, 22, 74], [250, 67, 179, 199, 23, 169], [249, 50, 232, 134, 97, 177]], [[174, 158, 169, 174, 200, 82], [120, 182, 169, 31, 39, 106], [169, 11, 125, 252, 246, 172], [100, 235, 117, 156, 145, 100], [106, 236, 75, 31, 73, 56]], [[245, 130, 188, 121, 196, 13], [ 98, 181, 186, 161, 145, 76], [178, 180, 97, 146, 180, 148], [ 70, 209, 138, 41, 56, 18], [193, 116, 111, 134, 199, 101]], [[150, 118, 153, 247, 135, 206], [152, 85, 182, 50, 20, 6], [ 4, 85, 28, 172, 161, 255], [ 40, 135, 47, 51, 35, 2], [ 63, 224, 13, 82, 215, 212]]], [[[191, 35, 215, 23, 227, 215], [ 17, 104, 164, 20, 160, 239], [135, 101, 40, 200, 91, 67], [130, 8, 75, 234, 31, 111], [ 93, 160, 90, 237, 111, 187]], [[206, 33, 158, 68, 137, 112], [239, 248, 109, 167, 91, 164], [154, 5, 41, 55, 127, 152], [ 85, 56, 142, 107, 133, 19], [150, 89, 196, 47, 36, 125]], [[210, 132, 94, 172, 197, 205], [151, 59, 246, 233, 102, 31], [ 4, 253, 160, 218, 180, 100], [212, 167, 27, 89, 113, 219], [200, 99, 142, 13, 224, 92]], [[ 30, 103, 173, 5, 76, 255], [155, 16, 6, 166, 212, 249], [ 56, 51, 143, 44, 242, 112], [139, 66, 243, 243, 57, 119], [ 29, 156, 138, 16, 199, 81]]], [[[ 97, 247, 66, 87, 71, 91], [ 25, 73, 9, 93, 119, 10], [ 62, 163, 224, 114, 199, 209], [ 9, 201, 159, 153, 85, 226], [166, 31, 190, 159, 25, 172]], [[ 2, 35, 44, 114, 74, 163], [253, 210, 100, 231, 201, 44], [ 87, 51, 207, 118, 151, 43], [ 84, 134, 31, 138, 99, 37], [122, 210, 104, 108, 231, 182]], [[122, 85, 19, 86, 2, 183], [149, 28, 65, 179, 9, 145], [221, 227, 92, 38, 235, 214], [ 75, 180, 212, 20, 173, 35], [ 17, 45, 137, 164, 32, 92]], [[177, 103, 100, 29, 53, 12], [ 95, 25, 12, 0, 254, 8], [171, 166, 118, 38, 58, 98], [128, 193, 109, 14, 251, 144], [121, 151, 138, 98, 224, 52]]]] **test_cc_bitwise_xor** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(4,), dtype=int32 [12, 10, -1, 0] y: shape=(4,), dtype=int32 [ 10, 6, 255, 0] Outputs: z: shape=(4,), dtype=int32 [ 6, 12, -256, 0] **test_cc_bitwise_xor_i64_2d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4), dtype=int64 [[ 2, -1, 0, 1], [ 0, 0, 0, 0], [ 0, 1, 0, 1]] y: shape=(3, 4), dtype=int64 [[ 0, 0, -1, 0], [ 0, -1, -1, 0], [ 0, -1, 0, -1]] Outputs: z: shape=(3, 4), dtype=int64 [[ 2, -1, -1, 1], [ 0, -1, -1, 0], [ 0, -2, 0, -2]] **test_cc_bitwise_xor_i8_2d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4), dtype=int8 [[0, 1, 0, 0], [0, 0, 0, 0], [0, 2, 0, 0]] y: shape=(3, 4), dtype=int8 [[ 0, 0, 0, -1], [ 0, -1, 0, 0], [ 0, 0, 1, 0]] Outputs: z: shape=(3, 4), dtype=int8 [[ 0, 1, 0, -1], [ 0, -1, 0, 0], [ 0, 2, 1, 0]] **test_cc_bitwise_xor_ui32_2d** .. code-block:: text Node: BitwiseXor(x, y) -> (z) .. code-block:: text Inputs: x: shape=(3, 4), dtype=uint32 [[ 227, 360, 65150, 36199], [61662, 13715, 51027, 1640], [30220, 45425, 20523, 62134]] y: shape=(3, 4), dtype=uint32 [[15112, 26786, 21932, 31065], [30893, 49705, 30179, 31380], [ 390, 40643, 28910, 52963]] Outputs: z: shape=(3, 4), dtype=uint32 [[15339, 27082, 43986, 62526], [34931, 63418, 45744, 31996], [30602, 12210, 8389, 15445]]