BitwiseAnd#
Domain:
ai.onnxSince version: 18
Returns the tensor resulting from performing the bitwise BitwiseAnd 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_and_i16_3d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4, 5), dtype=int16
[[[ 0, 0, 0, 0, 0],
[-1, 0, -1, -2, 0],
[ 0, 0, -1, 0, 0],
[ 0, 1, 0, 0, 0]],
[[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[-2, 1, 0, 0, 1],
[ 0, 0, 0, 1, 0]],
[[ 0, 0, 1, 1, 0],
[ 0, 0, 0, 0, 1],
[ 0, 0, 0, 0, -1],
[ 0, 0, 1, -1, 0]]]
y: shape=(3, 4, 5), dtype=int16
[[[ 0, 0, 1, 0, 1],
[-1, 0, -1, 1, 0],
[ 0, -1, 0, 0, 0],
[-1, -1, 0, 0, 0]],
[[ 1, 0, 0, 0, 0],
[ 0, 0, 0, -1, -1],
[ 0, -1, 0, 0, 0],
[-1, 0, 0, 0, 0]],
[[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, -2, 0],
[ 0, 0, 0, 0, 0]]]
Outputs:
z: shape=(3, 4, 5), dtype=int16
[[[ 0, 0, 0, 0, 0],
[-1, 0, -1, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 1, 0, 0, 0]],
[[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 1, 0, 0, 0],
[ 0, 0, 0, 0, 0]],
[[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0]]]
test_bitwise_and_i32_2d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4), dtype=int32
[[ 0, 0, 0, 0],
[ 1, 1, 0, 0],
[ 0, 0, -1, 0]]
y: shape=(3, 4), dtype=int32
[[ 0, 0, 1, 0],
[ 0, -1, -1, 0],
[ 0, -1, 0, -2]]
Outputs:
z: shape=(3, 4), dtype=int32
[[0, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 0, 0]]
test_bitwise_and_ui64_bcast_3v1d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4, 5), dtype=uint64
[[[ 643, 14691, 21920, 13356, 21774],
[31177, 30951, 39415, 29714, 22602],
[36984, 31846, 25772, 28745, 57533],
[12062, 49710, 44007, 58453, 52235]],
[[31453, 53014, 48850, 48464, 48550],
[ 2308, 25567, 59825, 33554, 47666],
[17584, 1293, 57552, 192, 2463],
[52477, 466, 57228, 25396, 42759]],
[[33891, 4843, 14557, 31760, 36710],
[16907, 39572, 20232, 27919, 47898],
[61397, 14818, 60661, 62999, 64271],
[ 6420, 58571, 29658, 47098, 40129]]]
y: shape=(5,), dtype=uint64
[59973, 52523, 46917, 41118, 36506]
Outputs:
z: shape=(3, 4, 5), dtype=uint64
[[[ 513, 2339, 5376, 8204, 1034],
[26689, 18467, 37189, 8210, 2058],
[32832, 19490, 9220, 8200, 32920],
[10756, 49194, 41797, 40980, 35850]],
[[27205, 52482, 46656, 40976, 35970],
[ 2052, 16651, 41217, 32786, 35346],
[16384, 1289, 41024, 128, 2202],
[51269, 258, 38660, 8212, 34306]],
[[32833, 43, 12357, 8208, 36354],
[16897, 34816, 1792, 8206, 35354],
[59973, 2338, 42053, 40982, 35338],
[ 2052, 50187, 13120, 41114, 35968]]]
test_bitwise_and_ui8_bcast_4v3d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4, 5, 6), dtype=uint8
[[[[133, 121, 55, 250, 175, 216],
[ 34, 254, 0, 225, 227, 85],
[ 48, 11, 191, 186, 71, 69],
[148, 213, 2, 209, 209, 241],
[134, 110, 2, 31, 157, 4]],
[[ 99, 34, 169, 90, 118, 126],
[143, 193, 73, 152, 31, 138],
[130, 239, 121, 187, 43, 205],
[ 4, 218, 2, 92, 79, 79],
[190, 169, 138, 209, 4, 128]],
[[148, 122, 32, 157, 73, 99],
[ 72, 74, 201, 152, 119, 153],
[ 37, 235, 119, 27, 215, 133],
[194, 179, 72, 91, 154, 137],
[138, 46, 26, 117, 34, 15]],
[[ 37, 196, 211, 223, 104, 113],
[136, 215, 185, 197, 188, 140],
[ 48, 72, 73, 84, 219, 52],
[ 65, 153, 168, 230, 144, 37],
[ 82, 21, 78, 138, 153, 3]]],
[[[ 39, 125, 78, 85, 62, 81],
[149, 217, 227, 113, 155, 112],
[202, 67, 196, 135, 152, 11],
[167, 102, 93, 199, 247, 175],
[147, 39, 245, 156, 182, 74]],
[[161, 34, 174, 189, 37, 102],
[ 75, 90, 76, 134, 87, 92],
[ 96, 165, 236, 6, 129, 171],
[ 32, 35, 105, 60, 234, 157],
[130, 31, 63, 43, 143, 71]],
[[240, 147, 242, 223, 107, 63],
[ 9, 20, 68, 219, 205, 230],
[ 63, 8, 87, 89, 88, 118],
[203, 226, 59, 143, 222, 81],
[135, 63, 250, 59, 184, 253]],
[[238, 135, 229, 135, 77, 160],
[143, 180, 8, 55, 129, 4],
[151, 66, 175, 171, 71, 151],
[137, 206, 229, 22, 44, 58],
[238, 173, 75, 120, 216, 163]]],
[[[ 39, 46, 243, 159, 207, 120],
[ 87, 169, 80, 74, 78, 126],
[ 59, 127, 121, 46, 88, 198],
[ 34, 183, 216, 123, 77, 59],
[233, 46, 125, 176, 186, 145]],
[[246, 73, 8, 144, 252, 64],
[111, 9, 24, 60, 68, 92],
[215, 102, 52, 79, 67, 84],
[ 21, 32, 61, 133, 28, 197],
[ 99, 129, 198, 46, 69, 20]],
[[ 54, 239, 196, 11, 9, 81],
[235, 171, 132, 206, 166, 10],
[ 9, 65, 27, 173, 229, 121],
[177, 236, 22, 188, 219, 135],
[199, 222, 158, 12, 3, 77]],
[[ 94, 24, 23, 47, 123, 170],
[208, 207, 174, 32, 148, 200],
[243, 234, 145, 167, 122, 174],
[214, 48, 46, 218, 23, 183],
[168, 46, 83, 245, 199, 157]]]]
y: shape=(4, 5, 6), dtype=uint8
[[[ 68, 183, 183, 33, 99, 32],
[250, 159, 58, 252, 232, 67],
[ 4, 251, 196, 26, 196, 253],
[ 0, 69, 162, 178, 186, 242],
[134, 181, 219, 215, 194, 53]],
[[182, 224, 145, 21, 79, 200],
[133, 2, 66, 149, 137, 246],
[121, 17, 30, 48, 162, 220],
[129, 53, 155, 71, 122, 56],
[ 81, 255, 22, 206, 162, 166]],
[[189, 149, 199, 145, 76, 155],
[122, 99, 92, 133, 156, 94],
[ 55, 241, 45, 158, 71, 239],
[ 44, 96, 132, 10, 245, 185],
[ 22, 242, 150, 231, 86, 137]],
[[111, 230, 18, 173, 142, 196],
[ 81, 246, 169, 137, 231, 65],
[229, 225, 41, 113, 52, 5],
[136, 16, 187, 68, 179, 75],
[130, 29, 112, 3, 177, 255]]]
Outputs:
z: shape=(3, 4, 5, 6), dtype=uint8
[[[[ 4, 49, 55, 32, 35, 0],
[ 34, 158, 0, 224, 224, 65],
[ 0, 11, 132, 26, 68, 69],
[ 0, 69, 2, 144, 144, 240],
[134, 36, 2, 23, 128, 4]],
[[ 34, 32, 129, 16, 70, 72],
[133, 0, 64, 144, 9, 130],
[ 0, 1, 24, 48, 34, 204],
[ 0, 16, 2, 68, 74, 8],
[ 16, 169, 2, 192, 0, 128]],
[[148, 16, 0, 145, 72, 3],
[ 72, 66, 72, 128, 20, 24],
[ 37, 225, 37, 26, 71, 133],
[ 0, 32, 0, 10, 144, 137],
[ 2, 34, 18, 101, 2, 9]],
[[ 37, 196, 18, 141, 8, 64],
[ 0, 214, 169, 129, 164, 0],
[ 32, 64, 9, 80, 16, 4],
[ 0, 16, 168, 68, 144, 1],
[ 2, 21, 64, 2, 145, 3]]],
[[[ 4, 53, 6, 1, 34, 0],
[144, 153, 34, 112, 136, 64],
[ 0, 67, 196, 2, 128, 9],
[ 0, 68, 0, 130, 178, 162],
[130, 37, 209, 148, 130, 0]],
[[160, 32, 128, 21, 5, 64],
[ 1, 2, 64, 132, 1, 84],
[ 96, 1, 12, 0, 128, 136],
[ 0, 33, 9, 4, 106, 24],
[ 0, 31, 22, 10, 130, 6]],
[[176, 145, 194, 145, 72, 27],
[ 8, 0, 68, 129, 140, 70],
[ 55, 0, 5, 24, 64, 102],
[ 8, 96, 0, 10, 212, 17],
[ 6, 50, 146, 35, 16, 137]],
[[110, 134, 0, 133, 12, 128],
[ 1, 180, 8, 1, 129, 0],
[133, 64, 41, 33, 4, 5],
[136, 0, 161, 4, 32, 10],
[130, 13, 64, 0, 144, 163]]],
[[[ 4, 38, 179, 1, 67, 32],
[ 82, 137, 16, 72, 72, 66],
[ 0, 123, 64, 10, 64, 196],
[ 0, 5, 128, 50, 8, 50],
[128, 36, 89, 144, 130, 17]],
[[182, 64, 0, 16, 76, 64],
[ 5, 0, 0, 20, 0, 84],
[ 81, 0, 20, 0, 2, 84],
[ 1, 32, 25, 5, 24, 0],
[ 65, 129, 6, 14, 0, 4]],
[[ 52, 133, 196, 1, 8, 17],
[106, 35, 4, 132, 132, 10],
[ 1, 65, 9, 140, 69, 105],
[ 32, 96, 4, 8, 209, 129],
[ 6, 210, 150, 4, 2, 9]],
[[ 78, 0, 18, 45, 10, 128],
[ 80, 198, 168, 0, 132, 64],
[225, 224, 1, 33, 48, 4],
[128, 16, 42, 64, 19, 3],
[128, 12, 80, 1, 129, 157]]]]
test_cc_bitwise_and
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(4,), dtype=int32
[12, 10, -1, 0]
y: shape=(4,), dtype=int32
[ 10, 6, 255, -1]
Outputs:
z: shape=(4,), dtype=int32
[ 8, 2, 255, 0]
test_cc_bitwise_and_i64_2d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4), dtype=int64
[[-1, 1, 0, 0],
[ 2, 0, 1, 1],
[ 0, 0, 0, 0]]
y: shape=(3, 4), dtype=int64
[[2, 1, 1, 1],
[0, 1, 0, 0],
[0, 1, 0, 0]]
Outputs:
z: shape=(3, 4), dtype=int64
[[2, 1, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
test_cc_bitwise_and_i8_2d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4), dtype=int8
[[ 0, 0, 0, -1],
[ 0, 0, -1, 0],
[ 1, 1, -1, 0]]
y: shape=(3, 4), dtype=int8
[[0, 1, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 0]]
Outputs:
z: shape=(3, 4), dtype=int8
[[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
test_cc_bitwise_and_ui32_2d
Node:
BitwiseAnd(x, y) -> (z)
Inputs:
x: shape=(3, 4), dtype=uint32
[[53852, 52129, 61145, 24102],
[30506, 7664, 62885, 38266],
[ 2982, 25853, 52247, 4967]]
y: shape=(3, 4), dtype=uint32
[[32607, 43009, 18604, 47354],
[56429, 26919, 57193, 13167],
[ 6771, 14996, 63644, 25052]]
Outputs:
z: shape=(3, 4), dtype=uint32
[[21084, 34817, 18568, 6178],
[21544, 2336, 54561, 4458],
[ 2594, 8340, 51220, 324]]