ai.onnx.OneHot / build /webgpu /test.json
Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
239770a verified
Raw
History Blame
42.2 kB
{
"op": "ai.onnx.OneHot",
"cases": [
{
"name": "float16_indices_depth_and_values",
"provenance": {
"notes": "Pins the exact ONNX float16 routes for independent indices, depth, and value type variables."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "float16", "shape": [4], "data": { "kind": "values", "values": [-1.0, 0.0, 2.0, 4.0] } },
"depth": { "dtype": "float16", "shape": [1], "data": { "kind": "values", "values": [4.0] } },
"values": { "dtype": "float16", "shape": [2], "data": { "kind": "values", "values": [-0.5, 2.0] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [4, 4], "tolerance": 0 } }
},
{
"name": "int16_indices_depth_and_values",
"provenance": {
"notes": "Pins widened-storage int16 support across all three independent OneHot type variables."
},
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "int16", "shape": [4], "data": { "kind": "values", "values": [-1, 0, 2, 3] } },
"depth": { "dtype": "int16", "shape": [], "data": { "kind": "values", "values": [3] } },
"values": { "dtype": "int16", "shape": [2], "data": { "kind": "values", "values": [-1234, 2345] } }
},
"outputs": { "output": { "dtype": "int16", "shape": [3, 4], "tolerance": 0 } }
},
{
"name": "int8_indices_depth_and_values",
"provenance": { "notes": "Pins signed 8-bit logical tensors through widened i32 shader storage." },
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "int8", "shape": [4], "data": { "kind": "values", "values": [-2, -1, 1, 4] } },
"depth": { "dtype": "int8", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "int8", "shape": [2], "data": { "kind": "values", "values": [-7, 101] } }
},
"outputs": { "output": { "dtype": "int8", "shape": [4, 4], "tolerance": 0 } }
},
{
"name": "uint8_indices_depth_and_values",
"provenance": { "notes": "Pins unsigned 8-bit logical tensors through widened u32 shader storage." },
"attrs": { "axis": 1 },
"inputs": {
"indices": { "dtype": "uint8", "shape": [2, 2], "data": { "kind": "values", "values": [0, 3, 4, 1] } },
"depth": { "dtype": "uint8", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "uint8", "shape": [2], "data": { "kind": "values", "values": [2, 251] } }
},
"outputs": { "output": { "dtype": "uint8", "shape": [2, 4, 2], "tolerance": 0 } }
},
{
"name": "bool_values_and_output",
"provenance": { "notes": "Pins ONNX boolean off/on payloads without exposing bool as an index or depth type." },
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [4], "data": { "kind": "values", "values": [-1, 0, 2, 3] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [3] } },
"values": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "bool", "shape": [4, 3], "tolerance": 0 } }
},
{
"name": "float32_indices_int16_depth_float32_values",
"provenance": {
"notes": "An integral float32 index route with independently typed int16 depth connects both standard type variables while the all-int16 sibling retains widened-storage coverage."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [-1.0, 0.0, 2.0, 3.0] } },
"depth": { "dtype": "int16", "shape": [1], "data": { "kind": "values", "values": [3] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-0.25, 1.5] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 3], "tolerance": 0 } }
},
{
"name": "float32_indices_int8_depth_float32_values",
"provenance": {
"notes": "An integral float32 index route with independently typed int8 depth connects both standard type variables while the all-int8 sibling retains widened-storage coverage."
},
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [-2.0, -1.0, 1.0, 4.0] } },
"depth": { "dtype": "int8", "shape": [], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.125, 2.5] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 4], "tolerance": 0 } }
},
{
"name": "float32_indices_uint8_depth_float32_values",
"provenance": {
"notes": "An integral float32 index route with independently typed uint8 depth connects both standard type variables while the all-uint8 sibling retains widened-storage coverage."
},
"attrs": { "axis": 1 },
"inputs": {
"indices": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 3.0, 4.0, 1.0] } },
"depth": { "dtype": "uint8", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-1.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 4, 2], "tolerance": 0 } }
},
{
"name": "int16_indices_depth_float32_values",
"provenance": { "notes": "Pairs int16 indices/depth with the independent float32 value/output route." },
"inputs": {
"indices": { "dtype": "int16", "shape": [1], "data": { "kind": "values", "values": [-1] } },
"depth": { "dtype": "int16", "shape": [], "data": { "kind": "values", "values": [2] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-0.25, 1.5] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [1, 2], "tolerance": 0 } }
},
{
"name": "int8_indices_depth_float32_values",
"provenance": { "notes": "Pairs int8 indices/depth with the independent float32 value/output route." },
"inputs": {
"indices": { "dtype": "int8", "shape": [1], "data": { "kind": "values", "values": [1] } },
"depth": { "dtype": "int8", "shape": [], "data": { "kind": "values", "values": [2] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.125, 2.5] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [1, 2], "tolerance": 0 } }
},
{
"name": "uint8_indices_depth_float32_values",
"provenance": { "notes": "Pairs uint8 indices/depth with the independent float32 value/output route." },
"inputs": {
"indices": { "dtype": "uint8", "shape": [1], "data": { "kind": "values", "values": [0] } },
"depth": { "dtype": "uint8", "shape": [], "data": { "kind": "values", "values": [2] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-1.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [1, 2], "tolerance": 0 } }
},
{
"name": "dispatch_cliff_axis0",
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [4], "data": { "kind": "cycle", "values": [0, 1000000, 4194240, 7] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4194241] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4194241, 4], "tolerance": 0 } }
},
{
"name": "rank1_last_axis",
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 2, 1] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 4] } }
},
{
"name": "f32_subnormal_values_last_axis_vec4",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_float_float_float",
"notes": "OneHot payload values may be valid positive subnormal floats; the last-axis vec4 path must not flush on-values to zero."
},
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 2, 1] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1e-40] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [3, 4],
"tolerance": 2e-45,
"data": {
"kind": "values",
"values": [9.99994610111476e-41, 0.0, 0.0, 0.0, 0.0, 0.0, 9.99994610111476e-41, 0.0, 0.0, 9.99994610111476e-41, 0.0, 0.0]
}
}
}
},
{
"name": "rank2_f16",
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 2], "data": { "kind": "values", "values": [0, 1, 2, 1] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } },
"values": { "dtype": "float16", "shape": [2], "data": { "kind": "values", "values": [-1.0, 2.0] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [2, 2, 3] } },
"tolerance": 0.001
},
{
"name": "rank2_axis0",
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 2], "data": { "kind": "values", "values": [0, 1, 2, 1] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-1.0, 2.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 2, 2], "tolerance": 0.000001 } }
},
{
"name": "f32_subnormal_values_axis0_negative_and_oob",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_Negative_NegIndex_NonDefault_NonZeroOffValue",
"notes": "Generic-axis payload edge with subnormal off/on values, negative index normalization, and an out-of-range index that must remain off."
},
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "int32", "shape": [4], "data": { "kind": "values", "values": [0, -1, 5, 1] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [3] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1e-40, 2e-40] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [3, 4],
"tolerance": 2e-45,
"data": {
"kind": "values",
"values": [1.999989220222952e-40, 9.99994610111476e-41, 9.99994610111476e-41, 9.99994610111476e-41, 9.99994610111476e-41, 9.99994610111476e-41, 9.99994610111476e-41, 1.999989220222952e-40, 9.99994610111476e-41, 1.999989220222952e-40, 9.99994610111476e-41, 9.99994610111476e-41]
}
}
}
},
{
"name": "rank4_indices_last_axis",
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [1, 2, 1, 2], "data": { "kind": "values", "values": [0, 2, 1, 3] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-1.0, 5.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [1, 2, 1, 2, 4], "tolerance": 0.000001 } }
},
{
"name": "rank5_indices_last_axis",
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [1, 2, 1, 2, 1], "data": { "kind": "values", "values": [0, 2, 1, 3] } },
"depth": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-1.0, 5.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [1, 2, 1, 2, 1, 4], "tolerance": 0.000001 } }
},
{
"name": "rank6_indices_axis0_output_rank7",
"attrs": { "axis": 0 },
"inputs": {
"indices": {
"dtype": "uint32",
"shape": [1, 2, 1, 2, 1, 2],
"data": { "kind": "values", "values": [0, 2, 1, 3, 2, 0, 3, 1] }
},
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-2.0, 6.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 1, 2, 1, 2, 1, 2], "tolerance": 0.000001 } }
},
{
"name": "scalar_depth",
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 2, 3] } },
"depth": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-3.0, 7.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.000001 } }
},
{
"name": "ort_default_axis_rank2_depth10",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis"
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_float_indices_float_depth_default_axis",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_float_float_float",
"notes": "Covers integral index and depth values carried by ONNX-permitted float32 tensors."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 9.0, 8.0, 2.0, 4.0, 6.0] }
},
"depth": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [10.0] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "float32_indices_float16_depth_nonzero_off",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_float_float_float_NonZeroOffValue",
"notes": "The ORT-derived integral float-index case uses float16 depth to cover the independent I/D type variables; arbitrary off/on values catch accidental zero-fill assumptions."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 9.0, 8.0, 2.0, 4.0, 6.0] }
},
"depth": { "dtype": "float16", "shape": [1], "data": { "kind": "values", "values": [10.0] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_int32_indices_depth_float_values_default_axis",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_int32_float_int32"
},
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_axis1_rank2_depth10",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_1"
},
"attrs": { "axis": 1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 10, 3], "tolerance": 0 } }
},
{
"name": "ort_negative_axis_nondefault_rank2_depth10",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_Negative_NonDefault"
},
"attrs": { "axis": -3 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 3], "tolerance": 0 } }
},
{
"name": "ort_int32_indices_float32_depth_values_nonzero_off_default_axis",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_int32_float_int32_NonZeroOffValue",
"notes": "The ORT case's depth is adapted from int32 to float32 to cover the independent I/D type variables while preserving its integral value and exact output."
},
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [10.0] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_default_axis_nonzero_off_value",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_NonZeroOffValue"
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_dim_with_zero_axis0",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DimWithZero"
},
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 0], "data": { "kind": "values", "values": [] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 0], "tolerance": 0 } }
},
{
"name": "ort_negative_index_axis_negative_nondefault",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_Negative_NegIndex_NonDefault"
},
"attrs": { "axis": -3 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, -1, 8, 2, 4, 6] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 3], "tolerance": 0 } }
},
{
"name": "ort_indices_out_of_range_default_axis_nonzero_off",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_IndicesOutOfRange_NonZeroOffValue"
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, -1, 8, 13, 4, -12] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "onnx_backend_onehot_negative_indices",
"attrs": { "axis": 1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [3], "data": { "kind": "values", "values": [0, -7, -8] } },
"depth": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 10] } },
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_onehot_negative_indices",
"notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable. Official backend depth is represented with framework uint32 metadata."
}
},
{
"name": "onnx_backend_onehot_with_axis",
"attrs": { "axis": 1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 2], "data": { "kind": "values", "values": [1, 9, 2, 4] } },
"depth": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 10, 2] } },
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_onehot_with_axis",
"notes": "Official backend fixture stores integer-looking indices/depth as floats; represented with framework integer metadata tensors. Official backend depth is represented with framework uint32 metadata."
}
},
{
"name": "onnx_backend_onehot_with_negative_axis",
"attrs": { "axis": -2 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 2], "data": { "kind": "values", "values": [1, 9, 2, 4] } },
"depth": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 10, 2] } },
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_onehot_with_negative_axis",
"notes": "Official backend fixture stores integer-looking indices/depth as floats; represented with framework integer metadata tensors. Official backend depth is represented with framework uint32 metadata."
}
},
{
"name": "onnx_backend_onehot_without_axis",
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 7, 8] } },
"depth": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [12] } },
"values": { "dtype": "int32", "shape": [2], "data": { "kind": "values", "values": [2, 5] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [3, 12] } },
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_onehot_without_axis",
"notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable. Official backend depth is represented with framework uint32 metadata."
}
},
{
"name": "ort_int32_values_exact_above_float24_default_axis",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_int64_int32_float_NonZeroOffValue",
"notes": "Uses framework int32 depth instead of ORT's float depth so WebGPU can treat depth as shape metadata."
},
"inputs": {
"indices": { "dtype": "int32", "shape": [4], "data": { "kind": "values", "values": [0, 2, -1, 5] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "int32", "shape": [2], "data": { "kind": "values", "values": [16777217, -16777219] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [4, 4], "tolerance": 0 } }
},
{
"name": "ort_int32_values_oob_indices_exact_above_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_IndicesOutOfRange_NonZeroOffValue"
},
"inputs": {
"indices": { "dtype": "int32", "shape": [4], "data": { "kind": "values", "values": [1, -1, 4, -7] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "int32", "shape": [2], "data": { "kind": "values", "values": [20000001, -20000003] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [4, 4], "tolerance": 0 } }
},
{
"name": "ort_axis0_nonzero_off_value_float",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_0_NonZeroOffValue",
"notes": "Pins axis-0 insertion with distinct nonzero off/on values 2 and 3, producing output shape [10,2,3]."
},
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 3], "tolerance": 0 } }
},
{
"name": "ort_axis2_nonzero_off_value_float",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_2_NonZeroOffValue",
"notes": "Pins axis-2 insertion with distinct nonzero off/on values 2 and 3, producing output shape [2,3,10]."
},
"attrs": { "axis": 2 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_depth_one_all_indices_on",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DepthOne"
},
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 0, 0] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-4.0, 9.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 1], "tolerance": 0 } }
},
{
"name": "ort_axis0_rank2_depth10",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_0",
"notes": "Uses uint32 indices/depth and float32 values in place of ORT's int64 tensors."
},
"attrs": { "axis": 0 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 3], "tolerance": 0 } }
},
{
"name": "ort_axis2_rank2_depth10",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_2",
"notes": "Uses uint32 indices/depth and float32 values in place of ORT's int64 tensors."
},
"attrs": { "axis": 2 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_axis1_nonzero_off_value_float",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_1_NonZeroOffValue",
"notes": "Uses uint32 indices/depth and float32 values in place of ORT's int64 tensors."
},
"attrs": { "axis": 1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 10, 3], "tolerance": 0 } }
},
{
"name": "ort_negative_axis_nondefault_nonzero_off_value_float",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_Negative_NonDefault_NonZeroOffValue",
"notes": "Uses uint32 indices/depth and float32 values in place of ORT's int64 tensors."
},
"attrs": { "axis": -3 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 3], "tolerance": 0 } }
},
{
"name": "ort_negative_axis_negative_index_nonzero_off_value",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.Axis_Negative_NegIndex_NonDefault_NonZeroOffValue",
"notes": "Uses int32 indices/depth and float32 values in place of ORT's int64 tensors."
},
"attrs": { "axis": -3 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, -1, 8, 2, 4, 6] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [10, 2, 3], "tolerance": 0 } }
},
{
"name": "ort_default_axis_indices_out_of_range_zero_off",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_IndicesOutOfRange",
"notes": "Uses int32 indices/depth and float32 values in place of ORT's int64 tensors."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, -1, 8, 13, 4, -12] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 3, 10], "tolerance": 0 } }
},
{
"name": "ort_default_axis_int32_f16_nonzero_off_value",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/onehot_op_test.cc",
"test": "OneHotOpTest.DefaultAxis_int32_MLFloat16_int32_NonZeroOffValue"
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 9, 8, 2, 4, 6] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [10] } },
"values": { "dtype": "float16", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": {
"output": {
"dtype": "float16",
"shape": [2, 3, 10],
"tolerance": 0,
"data": {
"kind": "values",
"values": [2.0, 3.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0]
}
}
}
},
{
"name": "f16_last_axis_vec4_depth8",
"provenance": {
"notes": "f16 OneHot with a depth divisible by 4 selects last_axis_vec4 with usesF16=true (a vec4<f16> 64-bit store). Every existing f16 case has depth 3 or 10 (not %4) and routes to the scalar generic_axis kernel, so the vec4<f16> store branch is entirely untested. A real f16 embedding/classification one-hot over a %4 vocab hits this path."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 5, 7] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8] } },
"values": { "dtype": "float16", "shape": [2], "data": { "kind": "values", "values": [-1.0, 2.0] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [3, 8], "tolerance": 0.001 } }
},
{
"name": "uint32_values_last_axis_vec4_extremes",
"provenance": {
"notes": "Standard ONNX uint32 payload coverage. Values above float32's exact-integer range ensure the values/output path remains integer-native while the depth-last vec4 route fills and scatters."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 3, 7] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [4294967295, 2147483649] } }
},
"outputs": {
"output": {
"dtype": "uint32",
"shape": [3, 4],
"tolerance": 0,
"data": {
"kind": "values",
"values": [2147483649, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 2147483649, 4294967295, 4294967295, 4294967295, 4294967295]
}
}
}
},
{
"name": "float_indices_last_axis_vec4_depth8",
"provenance": {
"notes": "Float32 indices with a depth divisible by 4 select last_axis_vec4 with floatIndices=true (i32(trunc(raw)) + negative-wrap, then a vec4 store). Every existing float-index case has depth 10 (not %4) and routes to generic_axis, so the floatIndices branch of the vec4 kernel is untested. ONNX permits numeric indices (cast to int); a negative float index exercises the truncation+wrap."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.0, 6.9, -1.0, 11.0] } },
"depth": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [8.0] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 8], "tolerance": 0 } }
},
{
"name": "f16_vocab256_default_axis",
"provenance": {
"notes": "Realistic f16 one-hot over a 256-wide vocab (depth %4) routed through last_axis_vec4 usesF16. Larger %4 depth than the depth8 case so several vec4 lanes are all-off before the on-lane, exercising the vec4 fill + single-lane scatter at a model-realistic width."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [5], "data": { "kind": "values", "values": [0, 1, 200, 255, 137] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [256] } },
"values": { "dtype": "float16", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [5, 256], "tolerance": 0.001 } }
},
{
"name": "int32_indices_last_axis_vec4_depth8_negwrap",
"provenance": {
"notes": "int32 indices with depth %4 select last_axis_vec4 usesI32 (negative-wrap + bounds). Covers the vec4 i32 branch with a model-realistic %4 depth and a negative index that must wrap to a valid slot plus an out-of-range index that must stay all-off."
},
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "int32", "shape": [4], "data": { "kind": "values", "values": [0, -1, 3, 99] } },
"depth": { "dtype": "int32", "shape": [1], "data": { "kind": "values", "values": [8] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 8], "tolerance": 0 } }
},
{
"name": "empty_output_last_axis_vec4_depth8",
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [0, 8], "tolerance": 0 } }
},
{
"name": "vec4_uint32_on_slot_last_lane_and_oob_depth8",
"attrs": { "axis": -1 },
"inputs": {
"indices": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [7, 8, 100, 4] } },
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-5.0, 9.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 8], "tolerance": 0 } }
},
{
"name": "generic_float_indices_middle_axis_negwrap",
"attrs": { "axis": 1 },
"inputs": {
"indices": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.0, 6.9, -1.0, 3.0, 10.0, 2.5] }
},
"depth": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 3.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 7, 3], "tolerance": 0 } }
},
{
"name": "rank7_indices_axis0_output_rank8",
"attrs": { "axis": 0 },
"inputs": {
"indices": {
"dtype": "uint32",
"shape": [1, 2, 1, 2, 1, 2, 2],
"data": { "kind": "cycle", "values": [0, 3, 1, 2] }
},
"depth": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
"values": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 1, 2, 1, 2, 1, 2, 2], "tolerance": 0.000001 } }
}
]
}