Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
9d0cf92 verified
Raw
History Blame
13.3 kB
{
"op": "ai.onnx.BitCast",
"cases": [
{
"name": "float32_to_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Float32ToInt32"
},
"attrs": { "to": 6 },
"inputs": {
"input": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.0, 1.0, -1.0, 0.5] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [4] } }
},
{
"name": "int32_to_float32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Int32ToFloat32"
},
"attrs": { "to": 1 },
"inputs": {
"input": { "dtype": "int32", "shape": [3], "data": { "kind": "values", "values": [0, 1065353216, 1073741824] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3] } }
},
{
"name": "uint32_to_float32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.UInt32ToFloat32"
},
"attrs": { "to": 1 },
"inputs": {
"input": {
"dtype": "uint32",
"shape": [3],
"data": { "kind": "values", "values": [0, 1065353216, 1073741824] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [3] } }
},
{
"name": "float32_to_uint32_rank2",
"attrs": { "to": 12 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
}
},
"outputs": { "output": { "dtype": "uint32", "shape": [2, 3] } }
},
{
"name": "scalar_float32_to_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.ScalarTensor"
},
"attrs": { "to": 6 },
"inputs": { "input": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [42.0] } } },
"outputs": { "output": { "dtype": "int32", "shape": [] } }
},
{
"name": "ort_float32_to_int32_rank2",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Float32ToInt32_2D"
},
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
}
},
"outputs": { "output": { "dtype": "int32", "shape": [2, 3] } }
},
{
"name": "ort_empty_float32_to_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.EmptyTensor"
},
"attrs": { "to": 6 },
"inputs": { "input": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } } },
"outputs": { "output": { "dtype": "int32", "shape": [0] } }
},
{
"name": "ort_float32_to_int32_rank3",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Float32ToInt32_3D"
},
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
}
},
"outputs": { "output": { "dtype": "int32", "shape": [2, 2, 3] } }
},
{
"name": "ort_float32_to_float32_identity",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Float32ToFloat32"
},
"attrs": { "to": 1 },
"inputs": {
"input": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.0, 2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3] } }
},
{
"name": "onnx_backend_uint32_to_int32_high_bits",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitcast_uint32_to_int32" },
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "uint32",
"shape": [3],
"data": { "kind": "values", "values": [4294967295, 2147483648, 2147483647] }
}
},
"outputs": { "output": { "dtype": "int32", "shape": [3], "tolerance": 0 } }
},
{
"name": "onnx_backend_float32_to_int32",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitcast_float32_to_int32" },
"attrs": { "to": 6 },
"inputs": {
"input": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.0, -2.5, 3.75] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [3], "tolerance": 0 } }
},
{
"name": "onnx_backend_float32_to_int32_rank2",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitcast_2d_float32_to_int32" },
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
}
},
"outputs": { "output": { "dtype": "int32", "shape": [2, 3], "tolerance": 0 } }
},
{
"name": "onnx_backend_scalar_float32_to_int32",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitcast_scalar_float32_to_int32" },
"attrs": { "to": 6 },
"inputs": { "input": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1.0] } } },
"outputs": { "output": { "dtype": "int32", "shape": [], "tolerance": 0 } }
},
{
"name": "onnx_backend_int32_to_float32",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_bitcast_int32_to_float32" },
"attrs": { "to": 1 },
"inputs": {
"input": {
"dtype": "int32",
"shape": [3],
"data": { "kind": "values", "values": [1065353216, -1071644672, 1081081856] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [3], "tolerance": 0 } }
},
{
"name": "float32_to_uint32_special_bits",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Float32ToInt32",
"notes": "Exercises the same byte-reinterpretation semantics on signed zero and infinities, with uint32 output so high bits are explicit."
},
"attrs": { "to": 12 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [6],
"data": { "kind": "values", "values": [0.0, -0.0, 1.0, -2.5, "Infinity", "-Infinity"] }
}
},
"outputs": {
"output": {
"dtype": "uint32",
"shape": [6],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 2147483648, 1065353216, 3223322624, 2139095040, 4286578688] }
}
}
},
{
"name": "uint32_to_float32_special_bits",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.UInt32ToFloat32",
"notes": "Pins down non-finite and signed-zero payloads so BitCast cannot silently become numeric conversion."
},
"attrs": { "to": 1 },
"inputs": {
"input": {
"dtype": "uint32",
"shape": [7],
"data": {
"kind": "values",
"values": [0, 2147483648, 2139095040, 4286578688, 1065353216, 3223322624, 2143289344]
}
}
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [7],
"tolerance": 0,
"allowNaN": true,
"data": { "kind": "values", "values": [0.0, 0.0, "Infinity", "-Infinity", 1.0, -2.5, "NaN"] }
}
}
},
{
"name": "int8_identity_pairwise_route",
"provenance": {
"notes": "Identity reinterpretation bridges the independently selectable signed and unsigned 8-bit input/output routes; the ORT-derived int8-to-uint8 sibling retains cross-signedness coverage."
},
"attrs": { "to": 3 },
"inputs": {
"input": { "dtype": "int8", "shape": [4], "data": { "kind": "values", "values": [-1, -128, 127, 0] } }
},
"outputs": {
"output": {
"dtype": "int8",
"shape": [4],
"tolerance": 0,
"data": { "kind": "values", "values": [-1, -128, 127, 0] }
}
}
},
{
"name": "int8_to_uint8_vectorized",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Int8ToUInt8",
"notes": "A four-element sibling pins the vectorized signed-to-unsigned byte reinterpretation as well as the scalar ORT fixture below."
},
"attrs": { "to": 2 },
"inputs": {
"input": { "dtype": "int8", "shape": [4], "data": { "kind": "values", "values": [0, -1, 127, -128] } }
},
"outputs": {
"output": {
"dtype": "uint8",
"shape": [4],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 255, 127, 128] }
}
}
},
{
"name": "ort_int8_to_uint8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.Int8ToUInt8"
},
"attrs": { "to": 2 },
"inputs": {
"input": { "dtype": "int8", "shape": [5], "data": { "kind": "values", "values": [0, 1, -1, 127, -128] } }
},
"outputs": {
"output": {
"dtype": "uint8",
"shape": [5],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 1, 255, 127, 128] }
}
}
},
{
"name": "ort_uint8_to_int8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/bitcast_op_test.cc",
"test": "BitCastTest.UInt8ToInt8"
},
"attrs": { "to": 3 },
"inputs": {
"input": { "dtype": "uint8", "shape": [5], "data": { "kind": "values", "values": [0, 1, 127, 128, 255] } }
},
"outputs": {
"output": {
"dtype": "int8",
"shape": [5],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 1, 127, -128, -1] }
}
}
},
{
"name": "float32_to_int32_rank6",
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 2, 2, 2, 2],
"data": { "kind": "linspace", "start": -1.0, "end": 1.0 }
}
},
"outputs": { "output": { "dtype": "int32", "shape": [2, 2, 2, 2, 2, 2], "tolerance": 0 } }
},
{
"name": "float32_to_int32_rank7",
"provenance": {
"source": "ONNX BitCast-26 contract and ONNX Runtime CPUExecutionProvider",
"notes": "BitCast preserves arbitrary tensor rank and only reinterprets same-width element bits."
},
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [1, 1, 1, 1, 1, 1, 4],
"data": { "kind": "values", "values": [0.0, 1.0, -1.0, 0.5] }
}
},
"outputs": {
"output": {
"dtype": "int32",
"shape": [1, 1, 1, 1, 1, 1, 4],
"data": { "kind": "values", "values": [0, 1065353216, -1082130432, 1056964608] },
"tolerance": 0
}
}
},
{
"name": "int32_to_float32_numel_not_mult4",
"attrs": { "to": 1 },
"inputs": {
"input": {
"dtype": "int32",
"shape": [5],
"data": { "kind": "values", "values": [0, 1065353216, 1073741824, -1082130432, 1086324736] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [5], "tolerance": 0 } }
},
{
"name": "float32_to_int32_rank8",
"attrs": { "to": 6 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 1, 1, 1, 1, 1, 2, 4],
"data": { "kind": "linspace", "start": -4.0, "end": 11.0 }
}
},
"outputs": { "output": { "dtype": "int32", "shape": [2, 1, 1, 1, 1, 1, 2, 4], "tolerance": 0 } }
},
{
"name": "uint8_to_int8_vec4_packed",
"provenance": {
"notes": "Eight uint8 elements exercise the packed uint8-to-int8 reinterpretation. Values straddle 128 in every vec4 lane, making sign extension visible lane by lane."
},
"attrs": { "to": 3 },
"inputs": {
"input": {
"dtype": "uint8",
"shape": [8],
"data": { "kind": "values", "values": [0, 1, 127, 128, 129, 200, 254, 255] }
}
},
"outputs": {
"output": {
"dtype": "int8",
"shape": [8],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 1, 127, -128, -127, -56, -2, -1] }
}
}
}
]
}