Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
5aca263 verified
Raw
History Blame
18.5 kB
{
"op": "ai.onnx.BitShift",
"cases": [
{
"name": "simple_left_u32",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.SimpleLeft"
}
},
{
"name": "simple_right_u32",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.SimpleRight"
}
},
{
"name": "broadcast_y_left_u8",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [3, 2], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } },
"y": { "dtype": "uint8", "shape": [2], "data": { "kind": "values", "values": [1, 2] } }
},
"outputs": { "z": { "dtype": "uint8", "shape": [3, 2] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.BroadcastYLeft_Uint8"
}
},
{
"name": "scalar_right_shift_by_width_u32",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1000] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [32, 33, 64] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3] } }
},
{
"name": "left_shift_by_logical_width_u8",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [1, 2, 128, 255] } },
"y": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [7, 8, 1, 9] } }
},
"outputs": { "z": { "dtype": "uint8", "shape": [4] } }
},
{
"name": "backend_right_uint32_high_bits",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": {
"dtype": "uint32",
"shape": [5],
"data": { "kind": "values", "values": [4294967295, 2147483648, 4000000001, 16777217, 305419896] }
},
"y": { "dtype": "uint32", "shape": [5], "data": { "kind": "values", "values": [1, 31, 4, 0, 8] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [5] } }
},
{
"name": "backend_left_uint32_high_bits",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": {
"dtype": "uint32",
"shape": [5],
"data": { "kind": "values", "values": [1, 3, 255, 16777217, 305419896] }
},
"y": { "dtype": "uint32", "shape": [5], "data": { "kind": "values", "values": [31, 30, 24, 8, 4] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [5] } }
},
{
"name": "scalar_left_shift_by_width_u32",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [3] } },
"y": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [30, 31, 32, 33] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [4] } }
},
{
"name": "right_shift_by_logical_width_u8",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [5], "data": { "kind": "values", "values": [255, 128, 64, 3, 1] } },
"y": { "dtype": "uint8", "shape": [5], "data": { "kind": "values", "values": [7, 8, 6, 1, 9] } }
},
"outputs": { "z": { "dtype": "uint8", "shape": [5] } }
},
{
"name": "ort_scalar_left_x_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.ScalarLeftX"
},
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [16] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "ort_scalar_left_y_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.ScalarLeftY"
},
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "ort_scalar_right_x_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.ScalarRightX"
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [16] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "ort_scalar_right_y_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.ScalarRightY"
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "ort_right_shift_by_bit_width_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.RightShiftByBitWidth_Uint32"
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [32, 32, 32] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "ort_right_shift_by_bit_width_u8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.RightShiftByBitWidth_Uint32",
"notes": "Same ORT shift-by-width invariant applied to logical uint8, whose bit width is 8."
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [255, 128, 1, 42] } },
"y": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [8, 8, 8, 8] } }
},
"outputs": {
"z": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [0, 0, 0, 0] }, "tolerance": 0 }
}
},
{
"name": "ort_left_shift_by_bit_width_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.LeftShiftByBitWidth_Uint64",
"notes": "ORT covers uint64; this framework exercises the same shift-by-width semantics with supported uint32 storage."
},
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [1000, 255, 1, 42] } },
"y": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [32, 32, 32, 32] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [4], "tolerance": 0 } }
},
{
"name": "ort_left_shift_by_bit_width_u8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.LeftShiftByBitWidth_Uint64",
"notes": "ORT covers uint64; this framework exercises the same shift-by-width invariant with logical uint8."
},
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [255, 128, 1, 42] } },
"y": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [8, 8, 8, 8] } }
},
"outputs": {
"z": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [0, 0, 0, 0] }, "tolerance": 0 }
}
},
{
"name": "ort_right_shift_by_more_than_bit_width_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.RightShiftByMoreThanBitWidth_Uint64",
"notes": "ORT covers uint64; this framework exercises the same shift-past-width semantics with supported uint32 storage."
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [1000, 42] } },
"y": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [33, 64] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [2], "tolerance": 0 } }
},
{
"name": "ort_right_shift_by_more_than_bit_width_u8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.RightShiftByMoreThanBitWidth_Uint64",
"notes": "ORT covers uint64; this framework exercises the same shift-past-width invariant with logical uint8."
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [255, 128, 1, 42] } },
"y": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [9, 16, 31, 255] } }
},
"outputs": {
"z": { "dtype": "uint8", "shape": [4], "data": { "kind": "values", "values": [0, 0, 0, 0] }, "tolerance": 0 }
}
},
{
"name": "ort_broadcast_x_right_u8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.BroadcastXRight_Uint8"
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [2], "data": { "kind": "values", "values": [64, 32] } },
"y": { "dtype": "uint8", "shape": [3, 2], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } }
},
"outputs": { "z": { "dtype": "uint8", "shape": [3, 2], "tolerance": 0 } }
},
{
"name": "ort_broadcast_x_right_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.BroadcastXRight",
"notes": "ORT uses uint64 values; this framework exercises the same broadcast pattern with supported uint32 storage."
},
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [64, 32] } },
"y": { "dtype": "uint32", "shape": [3, 2], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 } }
},
{
"name": "ort_broadcast_y_left_u32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc",
"test": "BitShiftOpTest.BroadcastYLeft",
"notes": "ORT uses uint64 values; this framework exercises the same broadcast pattern with supported uint32 storage."
},
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3, 2], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } },
"y": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [1, 2] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 } }
},
{
"name": "onnx_backend_bitshift_left_uint32",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitshift_left_uint32" },
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "onnx_backend_bitshift_right_uint32",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitshift_right_uint32" },
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [3], "tolerance": 0 } }
},
{
"name": "onnx_backend_bitshift_left_uint8",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitshift_left_uint8" },
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint8", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint8", "shape": [3], "tolerance": 0 } }
},
{
"name": "onnx_backend_bitshift_right_uint8",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitshift_right_uint8" },
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [3], "data": { "kind": "values", "values": [16, 4, 1] } },
"y": { "dtype": "uint8", "shape": [3], "data": { "kind": "values", "values": [1, 2, 3] } }
},
"outputs": { "z": { "dtype": "uint8", "shape": [3], "tolerance": 0 } }
},
{
"name": "vec4_right_u32_with_overwide_shifts",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": {
"dtype": "uint32",
"shape": [8],
"data": { "kind": "values", "values": [4294967295, 1024, 7, 4294967295, 256, 65535, 8, 12345678] }
},
"y": { "dtype": "uint32", "shape": [8], "data": { "kind": "values", "values": [4, 10, 1, 32, 33, 0, 3, 8] } }
},
"outputs": {
"z": {
"dtype": "uint32",
"shape": [8],
"data": { "kind": "values", "values": [268435455, 1, 3, 0, 0, 65535, 1, 48225] },
"tolerance": 0
}
}
},
{
"name": "vec4_right_u8_with_overwide_shifts",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": {
"dtype": "uint8",
"shape": [8],
"data": { "kind": "values", "values": [255, 128, 200, 7, 255, 16, 3, 9] }
},
"y": { "dtype": "uint8", "shape": [8], "data": { "kind": "values", "values": [1, 7, 8, 0, 9, 2, 1, 3] } }
},
"outputs": {
"z": {
"dtype": "uint8",
"shape": [8],
"data": { "kind": "values", "values": [127, 1, 0, 7, 0, 4, 1, 1] },
"tolerance": 0
}
}
},
{
"name": "empty_input_zero_dim",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } },
"y": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [0], "tolerance": 0 } }
},
{
"name": "broadcast_2d_u8_non_mult4_left",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint8", "shape": [1, 3], "data": { "kind": "values", "values": [1, 2, 3] } },
"y": { "dtype": "uint8", "shape": [2, 1], "data": { "kind": "values", "values": [1, 2] } }
},
"outputs": {
"z": {
"dtype": "uint8",
"shape": [2, 3],
"tolerance": 0,
"data": { "kind": "values", "values": [2, 4, 6, 4, 8, 12] }
}
}
},
{
"name": "empty_z_broadcast_scalar_x",
"attrs": { "direction": "RIGHT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [255] } },
"y": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } }
},
"outputs": {
"z": { "dtype": "uint32", "shape": [0], "tolerance": 0, "data": { "kind": "values", "values": [] } }
}
},
{
"name": "rank7_broadcast_scalar_tail",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": { "dtype": "uint32", "shape": [2, 1, 2, 1, 2, 1, 3], "data": { "kind": "cycle", "values": [1, 3, 7, 15] } },
"y": { "dtype": "uint32", "shape": [1, 2, 1, 2, 1, 2, 1], "data": { "kind": "cycle", "values": [0, 1, 2] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [2, 2, 2, 2, 2, 2, 3], "tolerance": 0 } }
},
{
"name": "rank8_broadcast_alternating",
"attrs": { "direction": "LEFT" },
"inputs": {
"x": {
"dtype": "uint32",
"shape": [2, 1, 2, 1, 2, 1, 2, 3],
"data": { "kind": "cycle", "values": [1, 3, 5, 7] }
},
"y": { "dtype": "uint32", "shape": [1, 2, 1, 2, 1, 2, 1, 1], "data": { "kind": "cycle", "values": [0, 1, 2] } }
},
"outputs": { "z": { "dtype": "uint32", "shape": [2, 2, 2, 2, 2, 2, 2, 3], "tolerance": 0 } }
}
]
}