ai.onnx.TopK / build /webgpu /test.json
Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
b6dbd82 verified
Raw
History Blame
84.3 kB
{
"op": "ai.onnx.TopK",
"cases": [
{
"name": "onnx_default_last_axis_omitted",
"provenance": {
"source": "https://onnx.ai/onnx/operators/onnx__TopK.html",
"test": "TopK axis default",
"notes": "Omitting axis must select the last dimension (ONNX default -1), not axis 1. Rank 3 makes those axes distinct, and both output values and indices are pinned. ONNX int64 indices use the framework's representable uint32 slot."
},
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 9.0, 3.0, 4.0, 2.0, 8.0, 7.0, 0.0, 6.0, 5.0, 11.0, 10.0] }
}
},
"outputs": {
"values": {
"dtype": "float32",
"shape": [2, 2, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [9.0, 8.0, 7.0, 11.0] }
},
"indices": {
"dtype": "uint32",
"shape": [2, 2, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 2, 0, 1] }
}
}
},
{
"name": "f32_largest_positive_subnormal_beats_zero",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1DefaultAxisLargestElements",
"notes": "A positive subnormal is strictly greater than zero; TopK should return its index rather than tie-breaking on a flushed zero."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [-1e-40, 0.0, 1e-40] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 1], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0 }
}
},
{
"name": "f32_largest_positive_subnormal_beats_zero_axis0",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1DefaultAxisLargestElements",
"notes": "Axis-0 companion for finite subnormal ordering: a positive subnormal is strictly greater than zero; TopK should return its index rather than tie-breaking on a flushed zero."
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": { "dtype": "float32", "shape": [3, 1], "data": { "kind": "values", "values": [-1e-40, 0.0, 1e-40] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 1], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0 }
}
},
{
"name": "f32_smallest_negative_subnormal_beats_zero",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2DefaultAxisSmallestElements",
"notes": "A negative subnormal is strictly less than zero; smallest TopK should return its index rather than tie-breaking on flushed zeros."
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [1e-40, 0.0, -1e-40] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 1], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0, "data": { "kind": "values", "values": [2] } }
}
},
{
"name": "f32_smallest_negative_subnormal_beats_zero_axis0",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisSmallestElements",
"notes": "Axis-0 companion for finite subnormal ordering: a negative subnormal is strictly less than zero; smallest TopK should return its index."
},
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": { "dtype": "float32", "shape": [3, 1], "data": { "kind": "values", "values": [1e-40, 0.0, -1e-40] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 1], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0, "data": { "kind": "values", "values": [2] } }
}
},
{
"name": "axis1_largest_sorted",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 5],
"data": { "kind": "values", "values": [1.5, 2.0, 2.0, -1.0, 0.5, 0.1, 3.0, 2.5, 3.0, -2.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1], "tolerance": 0 }
}
},
{
"name": "ort_top1_default_axis_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1DefaultAxisLargestElements"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.3, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1], "tolerance": 0 }
}
},
{
"name": "ort_top2_default_axis_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2DefaultAxisLargestElements"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.4, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "ort_top3_default_axis_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3DefaultAxisLargestElements"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.4, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 }
}
},
{
"name": "ort_top_all_default_axis_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopAllDefaultAxisLargestElements"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.3, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "ort_top2_default_axis_smallest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2DefaultAxisSmallestElements"
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.4, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "ort_top3_axis0_smallest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisSmallestElements"
},
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.3, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 }
}
},
{
"name": "ort_top1_rank3_axis1_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1ExplicitAxisMultiDInputLargestElements"
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1, 2], "tolerance": 0 }
}
},
{
"name": "ort_top1_rank3_axis1_smallest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1ExplicitAxisMultiDInputSmallestElements"
},
"attrs": { "axis": 1, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1, 2], "tolerance": 0 }
}
},
{
"name": "ort_top2_axis0_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2ExplicitAxisLargestElements"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 11.0, 8.0, 5.0, 6.0, 7.0, 4.0, 9.0, 10.0, 3.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "ort_top_all_axis0_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopAllExplicitAxisLargestElements"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.3, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [4, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [4, 2], "tolerance": 0 }
}
},
{
"name": "tie_breaks_lower_index",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 6],
"data": { "kind": "values", "values": [5.0, 5.0, 4.0, 5.0, 3.0, 5.0, 1.0, 2.0, 2.0, 2.0, -1.0, -1.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "smallest_tie_breaks_lower_index",
"attrs": { "axis": 1, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 6],
"data": { "kind": "values", "values": [-5.0, -5.0, -4.0, -5.0, 3.0, -5.0, 1.0, -2.0, -2.0, -2.0, -1.0, -1.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 }
}
},
{
"name": "axis0_largest_sorted",
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [1.0, 5.0, 3.0, 4.0, 2.0, 5.0, 7.0, 1.0, 3.0, 4.0, 7.0, 9.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "axis0_smallest_sorted",
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [1.0, 5.0, 3.0, 4.0, 2.0, 5.0, -7.0, 1.0, 3.0, 4.0, -7.0, 9.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "axis_minus_one_largest_sorted",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 5],
"data": { "kind": "values", "values": [0.5, 4.0, 4.0, -1.0, 2.0, 7.0, 1.0, 7.0, 3.0, 7.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 }
}
},
{
"name": "axis1_largest_unsorted_attr",
"attrs": { "axis": 1, "largest": 1, "sorted": 0 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 5],
"data": { "kind": "values", "values": [1.0, 5.0, 3.0, 4.0, 2.0, 2.0, 8.0, 7.0, 6.0, 1.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1], "tolerance": 0 }
}
},
{
"name": "axis_minus_two_largest_sorted",
"attrs": { "axis": -2, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [1.0, 5.0, 3.0, 4.0, 2.0, 5.0, 7.0, 1.0, 3.0, 4.0, 7.0, 9.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "rank3_last_axis_largest_sorted_ties",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2, 5],
"data": {
"kind": "values",
"values": [1.0, 4.0, 4.0, -2.0, 3.0, 0.0, -1.0, -1.0, 5.0, 5.0, 9.0, 8.0, 9.0, 7.0, 6.0, -3.0, -3.0, -4.0, -2.0, -2.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2, 2], "tolerance": 0 }
}
},
{
"name": "ort_rank3_last_axis_largest_nan_rows",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2DefaultAxisLargestElements",
"notes": "NaN extension of ORT's largest sorted TopK coverage. Includes an all-NaN row and a finite-tie row where a NaN sentinel appears after finite values."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 4],
"data": { "kind": "values", "values": ["NaN", "NaN", "NaN", "NaN", 1.0, "NaN", 1.0, 0.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 2, 2], "tolerance": 0, "allowNaN": true },
"indices": { "dtype": "uint32", "shape": [1, 2, 2], "tolerance": 0 }
}
},
{
"name": "rank3_last_axis_smallest_sorted_ties",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2, 5],
"data": {
"kind": "values",
"values": [1.0, -4.0, -4.0, 2.0, -3.0, 0.0, -1.0, -1.0, -5.0, -5.0, -9.0, -8.0, -9.0, -7.0, -6.0, 3.0, 3.0, 4.0, 2.0, 2.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2, 2], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_largest_sorted_ties",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4, 3],
"data": {
"kind": "values",
"values": [1.0, 5.0, 2.0, 3.0, 5.0, 4.0, 3.0, -1.0, 6.0, 0.0, 7.0, 6.0, -2.0, 10.0, 0.0, -2.0, 8.0, 0.0, 4.0, 8.0, -1.0, 4.0, 9.0, -1.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2, 3], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_smallest_sorted_ties",
"attrs": { "axis": 1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4, 3],
"data": {
"kind": "values",
"values": [-1.0, 5.0, -2.0, -3.0, 5.0, -4.0, -3.0, -1.0, -6.0, 0.0, 7.0, -6.0, 2.0, -10.0, 0.0, 2.0, -8.0, 0.0, -4.0, -8.0, 1.0, -4.0, -9.0, 1.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2, 3], "tolerance": 0 }
}
},
{
"name": "rank3_axis0_largest_sorted_ties",
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2, 3],
"data": {
"kind": "values",
"values": [1.0, 9.0, 3.0, 4.0, 5.0, 6.0, 2.0, 9.0, 7.0, 4.0, 8.0, 6.0, 3.0, 1.0, 7.0, 2.0, 8.0, 0.0, 3.0, 9.0, -1.0, 4.0, 0.0, 6.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2, 3], "tolerance": 0 }
}
},
{
"name": "rank3_axis0_smallest_sorted_ties",
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2, 3],
"data": {
"kind": "values",
"values": [-1.0, -9.0, 3.0, 4.0, -5.0, -6.0, -2.0, -9.0, -7.0, 4.0, -8.0, -6.0, -3.0, -1.0, -7.0, 2.0, -8.0, 0.0, -3.0, -9.0, -1.0, 4.0, 0.0, -6.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2, 3], "tolerance": 0 }
}
},
{
"name": "rank4_last_axis_largest_sorted_ties",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 4],
"data": {
"kind": "values",
"values": [1.0, 4.0, 4.0, 2.0, 0.0, 5.0, 5.0, 3.0, 7.0, 6.0, 7.0, 1.0, -2.0, -2.0, -3.0, -1.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 2, 2, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 2, 2, 2], "tolerance": 0 }
}
},
{
"name": "rank4_last_axis_smallest_sorted_ties",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 4],
"data": {
"kind": "values",
"values": [-1.0, -4.0, -4.0, -2.0, 0.0, -5.0, -5.0, -3.0, -7.0, -6.0, -7.0, -1.0, 2.0, 2.0, 3.0, 1.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 2, 2, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 2, 2, 2], "tolerance": 0 }
}
},
{
"name": "top0_default_axis_largest_empty_outputs",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top0DefaultAxisLargestElements"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 0 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.3, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 0], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 0], "tolerance": 0 }
}
},
{
"name": "top0_axis0_empty_outputs",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top0DefaultAxisLargestElements"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 0 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": { "kind": "values", "values": [0.1, 0.3, 0.2, 0.4, 0.1, 0.3, 0.3, 0.2] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [0, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [0, 2], "tolerance": 0 }
}
},
{
"name": "rank1_top_all_largest_ort",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopAllExplicitAxis1DInputLargestElements"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 13 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [13],
"data": {
"kind": "values",
"values": [93.0, 695.0, 971.0, 978.0, 483.0, 247.0, 242.0, 983.0, 531.0, 723.0, 285.0, 527.0, 862.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [13], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [13], "tolerance": 0 }
}
},
{
"name": "rank1_top2_repeated_maxima_lower_index",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopAllExplicitAxis1DLargeInputLargestElements"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [16],
"data": {
"kind": "values",
"values": [93.0, 695.0, 971.0, 978.0, 483.0, 247.0, 242.0, 983.0, 531.0, 723.0, 93.0, 695.0, 971.0, 983.0, 483.0, 247.0]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2], "tolerance": 0 }
}
},
{
"name": "f16_rank1_nth_element_negative_values",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.NthElementHalf_NegtiveVals"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float16",
"shape": [6],
"data": { "kind": "values", "values": [10.0, -8.0, -7.0, -4.0, -5.0, -6.0] }
}
},
"outputs": {
"values": { "dtype": "float16", "shape": [4], "tolerance": 0.00098 },
"indices": { "dtype": "uint32", "shape": [4], "tolerance": 0 }
}
},
{
"name": "smallest_non_power_of_two_positive_infinity_padding",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [1.0, 2.0, "Infinity"] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 3], "tolerance": 0 }
}
},
{
"name": "largest_non_power_of_two_negative_infinity_padding",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [-1.0, -2.0, "-Infinity"] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 3], "tolerance": 0 }
}
},
{
"name": "top3_all_same_smallest_lower_indices",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3AllSame"
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 }
}
},
{
"name": "ort_axis0_all_positive_infinity_largest_ties",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisInfinity"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": {
"kind": "values",
"values": ["Infinity", "Infinity", "Infinity", "Infinity", "Infinity", "Infinity", "Infinity", "Infinity"]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 }
}
},
{
"name": "ort_axis0_all_negative_infinity_largest_ties",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisInfinity"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": {
"kind": "values",
"values": ["-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity"]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 }
}
},
{
"name": "large_rank1_one_merge_all_ties_largest",
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 8 },
"inputs": { "x": { "dtype": "float32", "shape": [4097], "data": { "kind": "constant", "value": 0.25 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [8], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [8], "tolerance": 0 }
}
},
{
"name": "large_axis1_one_merge_all_ties_smallest",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 7 },
"inputs": { "x": { "dtype": "float32", "shape": [2, 4099], "data": { "kind": "constant", "value": -0.5 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [2, 7], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 7], "tolerance": 0 }
}
},
{
"name": "large_axis1_two_merge_vocab_top100_ties",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 100 },
"inputs": { "x": { "dtype": "float32", "shape": [1, 43009], "data": { "kind": "constant", "value": 1.0 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [1, 100], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 100], "tolerance": 0 }
}
},
{
"name": "large_axis1_two_merge_smallest_ties",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 100 },
"inputs": { "x": { "dtype": "float32", "shape": [1, 43009], "data": { "kind": "constant", "value": -1.0 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [1, 100], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 100], "tolerance": 0 }
}
},
{
"name": "large_f16_one_merge_generated_logits",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 6 },
"inputs": {
"x": {
"dtype": "float16",
"shape": [1, 3000],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float16", "shape": [1, 6], "tolerance": 0.00098 },
"indices": { "dtype": "uint32", "shape": [1, 6], "tolerance": 0 }
}
},
{
"name": "large_top0_last_axis_empty_outputs",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 0 },
"inputs": { "x": { "dtype": "float32", "shape": [2, 4097], "data": { "kind": "constant", "value": 0.0 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [2, 0], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 0], "tolerance": 0 }
}
},
{
"name": "large_top1_last_axis_all_ties_lower_index",
"attrs": { "axis": -1, "largest": 1, "sorted": 0 },
"args": { "k": 1 },
"inputs": { "x": { "dtype": "float32", "shape": [1, 4097], "data": { "kind": "constant", "value": 3.0 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0 }
}
},
{
"name": "large_top1_last_axis_smallest_generated",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 3001],
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.031, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1], "tolerance": 0 }
}
},
{
"name": "last_axis_top1_smallest_generated",
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 129],
"data": { "kind": "fillFloat32", "sinStep": 0.019, "cosStep": 0.043, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [3, 1], "tolerance": 0 }
}
},
{
"name": "rank1_axis0_smallest_sorted_tie_lower_index",
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [7],
"data": { "kind": "values", "values": [3.0, -1.5, 2.0, -1.5, 0.0, 5.0, -4.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [3], "tolerance": 0 }
}
},
{
"name": "f16_axis0_non_last_all_ties",
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": { "x": { "dtype": "float16", "shape": [6, 4], "data": { "kind": "constant", "value": 2.0 } } },
"outputs": {
"values": { "dtype": "float16", "shape": [2, 4], "tolerance": 0.00098 },
"indices": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_unsorted_top1_smallest",
"attrs": { "axis": 1, "largest": 0, "sorted": 0 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 5, 3],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.07, "scale": 1.5 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1, 3], "tolerance": 0 }
}
},
{
"name": "ort_axis0_top3_positive_infinity_smallest",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisInfinity"
},
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": {
"kind": "values",
"values": ["Infinity", "Infinity", "Infinity", "Infinity", "Infinity", "Infinity", "Infinity", "Infinity"]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 }
}
},
{
"name": "ort_axis0_top3_negative_infinity_smallest",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisInfinity"
},
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 2],
"data": {
"kind": "values",
"values": ["-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity", "-Infinity"]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [3, 2], "tolerance": 0 }
}
},
{
"name": "ort_rank1_nth_element_k4_f32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.NthElement"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [6],
"data": { "kind": "values", "values": [10.0, 8.0, 7.0, 4.0, 5.0, 6.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [4], "tolerance": 0 }
}
},
{
"name": "ort_rank1_nth_element_k4_negative_values",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.NthElementHalf_NegtiveVals"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [6],
"data": { "kind": "values", "values": [10.0, -8.0, -7.0, -4.0, -5.0, -6.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [4], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [4], "tolerance": 0 }
}
},
{
"name": "ort_rank1_nth_element_k4_f16",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.NthElementHalf"
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float16",
"shape": [6],
"data": { "kind": "values", "values": [10.0, 8.0, 7.0, 4.0, 5.0, 6.0] }
}
},
"outputs": {
"values": { "dtype": "float16", "shape": [4], "tolerance": 0.00098 },
"indices": { "dtype": "uint32", "shape": [4], "tolerance": 0 }
}
},
{
"name": "rank1_axis0_largest_k100_merge",
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 100 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1024],
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.031, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [100], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [100], "tolerance": 0 }
}
},
{
"name": "ort_top3_all_same_smallest_tie_lower_index",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3AllSame"
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": { "x": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "constant", "value": 0.1 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 }
}
},
{
"name": "onnx_backend_top_k",
"attrs": { "axis": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 3] },
"indices": { "dtype": "uint32", "shape": [3, 3] }
},
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_top_k",
"notes": "ONNX TopK K input represented as framework scalar arg k. ONNX int64 tensors use framework int32/uint32 slots where representable."
}
},
{
"name": "onnx_backend_top_k_negative_axis",
"attrs": { "axis": -1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 3] },
"indices": { "dtype": "uint32", "shape": [3, 3] }
},
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_top_k_negative_axis",
"notes": "ONNX TopK K input represented as framework scalar arg k. ONNX int64 tensors use framework int32/uint32 slots where representable."
}
},
{
"name": "onnx_backend_top_k_smallest",
"attrs": { "axis": 1, "largest": 0, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 11.0, 10.0, 9.0, 8.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 3] },
"indices": { "dtype": "uint32", "shape": [3, 3] }
},
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_top_k_smallest",
"notes": "ONNX TopK K input represented as framework scalar arg k. ONNX int64 tensors use framework int32/uint32 slots where representable."
}
},
{
"name": "onnx_backend_top_k_same_values_2d",
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_top_k_same_values_2d",
"notes": "Official value tensor is int64; adapted to float32 because this TopK manifest supports floating values and uint32 indices."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [3, 4],
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 1.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [3, 3], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [3, 3], "tolerance": 0 }
}
},
{
"name": "onnx_backend_top_k_same_values_largest",
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_top_k_same_values_largest",
"notes": "Official value tensors use int64; this fixture adapts them to supported float32 values and uint32 indices. The test_top_k_same_values vector projects to this same explicit largest=1 request."
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0] } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [3], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [3], "tolerance": 0 }
}
},
{
"name": "ort_int8_largest_sorted_tie_indices",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int8"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int8",
"shape": [2, 4],
"data": { "kind": "values", "values": [10, 30, 20, 40, 10, 30, 40, 20] }
}
},
"outputs": {
"values": { "dtype": "int8", "shape": [2, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "ort_int8_negative_largest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int8_Negative"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int8",
"shape": [2, 4],
"data": { "kind": "values", "values": [-10, -30, -20, -40, -10, -30, -40, -20] }
}
},
"outputs": {
"values": { "dtype": "int8", "shape": [2, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "ort_int8_smallest_sorted",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int8_Smallest"
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int8",
"shape": [2, 4],
"data": { "kind": "values", "values": [10, 30, 20, 40, 10, 30, 40, 20] }
}
},
"outputs": {
"values": { "dtype": "int8", "shape": [2, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "ort_int16_largest_sorted_tie_indices",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int16"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int16",
"shape": [2, 4],
"data": { "kind": "values", "values": [100, 300, 200, 400, 100, 300, 400, 200] }
}
},
"outputs": {
"values": { "dtype": "int16", "shape": [2, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "ort_uint8_largest_sorted_tie_indices",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Uint8"
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "uint8",
"shape": [2, 4],
"data": { "kind": "values", "values": [10, 30, 20, 40, 10, 30, 40, 20] }
}
},
"outputs": {
"values": { "dtype": "uint8", "shape": [2, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "int32_largest_sorted_tie_indices",
"provenance": {
"source": "https://github.com/onnx/onnx/blob/main/docs/Operators.md#TopK",
"notes": "ONNX TopK permits int32 value tensors."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 4],
"data": { "kind": "values", "values": [10, 30, 20, 40, 40, 30, 40, 20] }
}
},
"outputs": {
"values": { "dtype": "int32", "shape": [2, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 }
}
},
{
"name": "int32_largest_exact_above_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1ExplicitAxisMultiDInputLargestElements",
"notes": "Distinct int32 values 16777216 and 16777217 must remain ordered by integer value, not by their rounded f32 representation."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 4],
"data": { "kind": "values", "values": [16777216, 16777217, 5, -3, 123456788, 123456789, 0, -7] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [2, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [16777217, 123456789] }
},
"indices": {
"dtype": "uint32",
"shape": [2, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 1] }
}
}
},
{
"name": "int32_smallest_exact_below_negative_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisSmallestElements",
"notes": "Distinct int32 values -16777216 and -16777217 must remain ordered by integer value, not by their rounded f32 representation."
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 4],
"data": { "kind": "values", "values": [-16777216, -16777217, 5, -3, -123456788, -123456789, 0, -7] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [2, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [-16777217, -123456789] }
},
"indices": {
"dtype": "uint32",
"shape": [2, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 1] }
}
}
},
{
"name": "axis0_int32_largest_exact_above_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top1ExplicitAxisLargestElements",
"notes": "Non-last-axis companion for exact int32 ordering: the axis sorter must compare and emit integer values without routing them through f32."
},
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 2],
"data": { "kind": "values", "values": [16777216, 123456789, 16777217, 123456788] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [16777217, 123456789] }
},
"indices": {
"dtype": "uint32",
"shape": [1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 0] }
}
}
},
{
"name": "axis0_int32_smallest_exact_below_negative_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top3ExplicitAxisSmallestElements",
"notes": "Non-last-axis signed companion for exact int32 ordering below -2^24; f32 round-trip collapses the chosen sentinel values."
},
"attrs": { "axis": 0, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 2],
"data": { "kind": "values", "values": [-16777216, -123456789, -16777217, -123456788] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [-16777217, -123456789] }
},
"indices": {
"dtype": "uint32",
"shape": [1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 0] }
}
}
},
{
"name": "int32_largest_top2_exact_above_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2ExplicitAxisMultiDInputLargestElements",
"notes": "Sorted k=2 must order exact int32 values before applying tie-breaking; an f32 comparison would see 16777216 and 16777217 as equal."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 4],
"data": { "kind": "values", "values": [16777216, 16777217, 5, -3, 123456788, 123456789, 0, -7] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [16777217, 16777216, 123456789, 123456788] }
},
"indices": {
"dtype": "uint32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 0, 1, 0] }
}
}
},
{
"name": "int32_smallest_top2_exact_below_negative_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.Top2ExplicitAxisMultiDInputSmallestElements",
"notes": "Sorted k=2 signed-smallest companion for exact int32 values below -2^24."
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 4],
"data": { "kind": "values", "values": [-16777216, -16777217, 5, -3, -123456788, -123456789, 0, -7] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [-16777217, -16777216, -123456789, -123456788] }
},
"indices": {
"dtype": "uint32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 0, 1, 0] }
}
}
},
{
"name": "rank3_axis1_int32_largest_exact_above_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int32_ExplicitAxis",
"notes": "Middle-axis TopK must use exact int32 ordering; this covers the rank-3 axis-1 path as well as the last-axis and axis-0 paths."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [1, 2, 2],
"data": { "kind": "values", "values": [16777216, 123456789, 16777217, 123456788] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [1, 1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [16777217, 123456789] }
},
"indices": {
"dtype": "uint32",
"shape": [1, 1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 0] }
}
}
},
{
"name": "rank3_axis1_int32_smallest_exact_below_negative_float24",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int32_ExplicitAxis",
"notes": "Middle-axis signed-smallest companion for exact int32 ordering below -2^24."
},
"attrs": { "axis": 1, "largest": 0, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [1, 2, 2],
"data": { "kind": "values", "values": [-16777216, -123456789, -16777217, -123456788] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [1, 1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [-16777217, -123456789] }
},
"indices": {
"dtype": "uint32",
"shape": [1, 1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [1, 0] }
}
}
},
{
"name": "ort_int8_explicit_axis_middle",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/topk_op_test.cc",
"test": "TopKOperator.TopK_Int8_ExplicitAxis"
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": { "dtype": "int8", "shape": [2, 2, 2], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6, 7, 8] } }
},
"outputs": {
"values": { "dtype": "int8", "shape": [2, 1, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 1, 2], "tolerance": 0 }
}
},
{
"name": "dispatch_cliff_rows_65537",
"provenance": {
"notes": "65537 rows > 65535 forces the folded primary-axis dispatch (x=65535, y=2) in topk-axis.wgsl.jinja. Validates row = workgroup_id.x + workgroup_id.y*nwg.x. The 11-value cycle shifts each row (8 mod 11) so rows differ and a wrong fold would mismatch; 8 distinct values per row avoid tie-break ambiguity. Before the 2D fold the plan-time dispatch-limit guard throws."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [65537, 8],
"data": { "kind": "cycle", "values": [0.1, 0.5, 0.9, 0.3, 0.7, 0.2, 0.6, 0.4, 0.8, 0.05, 0.95] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [65537, 4], "tolerance": 0.00001 },
"indices": { "dtype": "uint32", "shape": [65537, 4], "tolerance": 0 }
}
},
{
"name": "dispatch_cliff_rank3_axis1_cols_65537",
"provenance": {
"notes": "rank3 axis1 top-k with dim2=65537 (>65535) forces the x->y dispatch fold (x=65535, y=2) while z carries the batch axis (dim0). Validates the col = wg.x + wg.y*nwg.x reconstruction in topk-axis.wgsl.jinja (axisLayout 2), guarded by col >= params.dim2. Before the fold the plan-time dispatch-limit guard throws."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2, 65537],
"data": { "kind": "cycle", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1, 65537], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 1, 65537], "tolerance": 0 }
}
},
{
"name": "f16_vocab_top1_large_block_argmax",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": {
"dtype": "float16",
"shape": [1, 4096],
"data": { "kind": "fillFloat32", "sinStep": 0.011, "cosStep": 0.027, "scale": 3.0 }
}
},
"outputs": {
"values": { "dtype": "float16", "shape": [1, 1], "tolerance": 0.001 },
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0 }
}
},
{
"name": "axis0_largest_k8_rows4096_tournament",
"attrs": { "axis": 0, "largest": 1, "sorted": 1 },
"args": { "k": 8 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4096, 8],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.037, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [8, 8], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [8, 8], "tolerance": 0 }
}
},
{
"name": "axis1_empty_row_dim_largest",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": { "x": { "dtype": "float32", "shape": [0, 6], "data": { "kind": "constant", "value": 1.0 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [0, 2], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [0, 2], "tolerance": 0 }
}
},
{
"name": "axis1_k_equals_cols_minus_one_pad_vs_real_zero",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 2046 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 2047],
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.023, "scale": 0.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 2046], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [2, 2046], "tolerance": 0 }
}
},
{
"name": "large_merge_last_axis_pos_inf_ties_lower_index",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 5 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 4100],
"data": {
"kind": "cycle",
"values": ["Infinity", 1.0, 2.0, "Infinity", 3.0, "Infinity", 0.5, 4.0, "Infinity", 2.5]
}
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 5], "tolerance": 0, "allowNaN": true },
"indices": { "dtype": "uint32", "shape": [2, 5], "tolerance": 0 }
}
},
{
"name": "small_row_batched_boundary_4097x8_k4",
"provenance": {
"notes": "Compact correctness and workgroup-tail lock for the batched small-row path used by MoE router logits; row 4096 starts a partial seventeenth workgroup and the 11-value cycle exercises row-dependent ordering and ties."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4097, 8],
"data": { "kind": "cycle", "values": [0.1, 0.5, 0.9, 0.3, 0.7, 0.2, 0.6, 0.4, 0.8, 0.05, 0.95] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [4097, 4], "tolerance": 0.00001 },
"indices": { "dtype": "uint32", "shape": [4097, 4], "tolerance": 0 }
}
},
{
"name": "rows_smallk_boundary_1025x128_k4",
"provenance": {
"notes": "Correctness, stable-tie, and partial-workgroup lock for the one-workgroup-per-row small-K paths. Fixed subgroup-32 devices use subgroup selection; other tiers use the portable shared-candidate merge instead of a full bitonic sort."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1025, 128],
"data": { "kind": "cycle", "values": [0.1, 0.5, 0.9, 0.3, 0.7, 0.2, 0.6, 0.4, 0.8, 0.05, 0.95] }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1025, 4], "tolerance": 0.00001 },
"indices": { "dtype": "uint32", "shape": [1025, 4], "tolerance": 0 }
}
},
{
"name": "small_row_batched_smallest_ties_4096x8_k4",
"provenance": {
"notes": "The consolidated batched-row variant also renders largest=0. Equal values must retain lower input indices in ascending index order."
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 4 },
"inputs": { "x": { "dtype": "float32", "shape": [4096, 8], "data": { "kind": "constant", "value": -1.0 } } },
"outputs": {
"values": { "dtype": "float32", "shape": [4096, 4], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [4096, 4], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_smallk_tournament_16x2048x16_k8",
"provenance": {
"notes": "Compact route lock for the strided small-k tournament path: 256 independent axis rows, eight local values per lane at the maximum 2048-axis specialization ratio, and sorted top-8 output."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 8 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [16, 2048, 16],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.037, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [16, 8, 16], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [16, 8, 16], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_k9_256x2048x1_tournament_boundary",
"provenance": {
"notes": "Compact lock for the k=8 to k=9 boundary. With 256 independent strided rows and axis 2048, it exercises tournament cursor exhaustion after one lane emits all of its local candidates."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 9 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [256, 2048, 1],
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.031, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [256, 9, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [256, 9, 1], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_2049x_k8_tournament_coverage",
"provenance": {
"notes": "Compact coverage lock one element beyond the historical 2048 non-last-axis ceiling. The tournament specializes to nine local candidates per lane and covers the shape without a generic-bitonic fallback."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 8 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [256, 2049, 1],
"data": { "kind": "fillFloat32", "sinStep": 0.019, "cosStep": 0.029, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [256, 8, 1], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [256, 8, 1], "tolerance": 0 }
}
},
{
"name": "large_int32_top1_preserves_exact_order",
"provenance": {
"notes": "Large-axis integer top-1 must use the native direct reducer: f32 split scratch would collapse 16777216 and 16777217 to the same value."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 1 },
"inputs": {
"x": { "dtype": "int32", "shape": [1, 2049], "data": { "kind": "cycle", "values": [16777216, 16777217] } }
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [1, 1],
"tolerance": 0,
"data": { "kind": "values", "values": [16777217] }
},
"indices": { "dtype": "uint32", "shape": [1, 1], "tolerance": 0, "data": { "kind": "values", "values": [1] } }
}
},
{
"name": "rank5_last_axis_generic_geometry",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 1, 2, 3, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.29, "scale": 2.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 1, 2, 3, 2], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 1, 2, 3, 2], "tolerance": 0 }
}
},
{
"name": "int32_large_axis_merge_top2_above_float24",
"provenance": {
"source": "onnxruntime/core/providers/webgpu/math/top_k.cc",
"test": "float-typed kernel registration",
"notes": "ORT restricts WebGPU TopK to float types; our large-axis merge kernels accept i32/u32, so the candidate scratch must preserve integer exactness (values above 2^24 and u32 above 2^31 are not f32-representable)."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [3, 2100],
"data": { "kind": "cycle", "values": [16777217, -16777217, 5, 16777216, -3, 0, 7, 16777215] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [3, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [16777217, 16777217, 16777217, 16777217, 16777217, 16777217] }
},
"indices": {
"dtype": "uint32",
"shape": [3, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 8, 4, 12, 0, 8] }
}
}
},
{
"name": "int32_large_axis_merge_smallest_below_negative_float24",
"provenance": {
"source": "onnxruntime/core/providers/webgpu/math/top_k.cc",
"test": "float-typed kernel registration",
"notes": "ORT restricts WebGPU TopK to float types; our large-axis merge kernels accept i32/u32, so the candidate scratch must preserve integer exactness (values above 2^24 and u32 above 2^31 are not f32-representable)."
},
"attrs": { "axis": -1, "largest": 0, "sorted": 1 },
"args": { "k": 2 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [2, 2100],
"data": { "kind": "cycle", "values": [-16777217, 16777217, -16777216, 4, -1] }
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [-16777217, -16777217, -16777217, -16777217] }
},
"indices": {
"dtype": "uint32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 5, 0, 5] }
}
}
},
{
"name": "uint32_large_axis_merge_top3_above_2pow31",
"provenance": {
"source": "onnxruntime/core/providers/webgpu/math/top_k.cc",
"test": "float-typed kernel registration",
"notes": "ORT restricts WebGPU TopK to float types; our large-axis merge kernels accept i32/u32, so the candidate scratch must preserve integer exactness (values above 2^24 and u32 above 2^31 are not f32-representable)."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 3 },
"inputs": {
"x": {
"dtype": "uint32",
"shape": [2, 2100],
"data": { "kind": "cycle", "values": [4294967295, 2147483648, 4294967294, 7, 0] }
}
},
"outputs": {
"values": {
"dtype": "uint32",
"shape": [2, 3],
"tolerance": 0,
"data": {
"kind": "values",
"values": [4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295]
}
},
"indices": {
"dtype": "uint32",
"shape": [2, 3],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 5, 10, 0, 5, 10] }
}
}
},
{
"name": "int32_large_axis_two_merge_k64_above_float24",
"provenance": {
"source": "onnxruntime/core/providers/webgpu/math/top_k.cc",
"test": "float-typed kernel registration",
"notes": "ORT restricts WebGPU TopK to float types; our large-axis merge kernels accept i32/u32, so the candidate scratch must preserve integer exactness (values above 2^24 and u32 above 2^31 are not f32-representable)."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 64 },
"inputs": {
"x": {
"dtype": "int32",
"shape": [1, 20480],
"data": {
"kind": "cycle",
"values": [16777217, 16777219, -16777217, 16777216, 3, 16777221, -5, 16777215, 0, 16777223]
}
}
},
"outputs": {
"values": {
"dtype": "int32",
"shape": [1, 64],
"tolerance": 0,
"data": {
"kind": "values",
"values": [16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223, 16777223]
}
},
"indices": {
"dtype": "uint32",
"shape": [1, 64],
"tolerance": 0,
"data": {
"kind": "values",
"values": [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, 159, 169, 179, 189, 199, 209, 219, 229, 239, 249, 259, 269, 279, 289, 299, 309, 319, 329, 339, 349, 359, 369, 379, 389, 399, 409, 419, 429, 439, 449, 459, 469, 479, 489, 499, 509, 519, 529, 539, 549, 559, 569, 579, 589, 599, 609, 619, 629, 639]
}
}
}
},
{
"name": "large_vocab_three_merge_k100_262144",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 100 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 262144],
"data": { "kind": "fillFloat32", "sinStep": 0.0137, "cosStep": 0.0071, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 100], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 100], "tolerance": 0 }
}
},
{
"name": "large_vocab_three_merge_k200_262144",
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 200 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 262144],
"data": { "kind": "fillFloat32", "sinStep": 0.0113, "cosStep": 0.0059, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 200], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 200], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_large_axis8192_k8",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 8 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 8192, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.0173, "cosStep": 0.0091, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [4, 8, 4], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [4, 8, 4], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_large_k32_6144",
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 32 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 6144, 8],
"data": { "kind": "fillFloat32", "sinStep": 0.0157, "cosStep": 0.0083, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [2, 32, 8], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [2, 32, 8], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_large_smallest_axis8192_k8",
"attrs": { "axis": 1, "largest": 0, "sorted": 1 },
"args": { "k": 8 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [4, 8192, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.0173, "cosStep": 0.0091, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [4, 8, 4], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [4, 8, 4], "tolerance": 0 }
}
},
{
"name": "two_merge_distinct_values_vocab_k16_262144",
"provenance": {
"notes": "Distinct (non-tie) data through the two-merge chain at vocab scale. Guards the scratch-binding semantic redirect: with name-first resolution the final merge silently re-read the stage-1 candidate buffer, which every all-ties fixture masked."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 16 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 262144],
"data": { "kind": "fillFloat32", "sinStep": 0.0137, "cosStep": 0.0071, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 16], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 16], "tolerance": 0 }
}
},
{
"name": "two_merge_monotonic_ramp_k128_8704",
"provenance": {
"notes": "Monotonic ramp: the true top-128 is the last 128 indices, so any stage reading a stale candidate buffer surfaces immediately (the name-first scratch lookup returned block-1 candidates here)."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 128 },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 8704], "data": { "kind": "linspace", "start": 0.0, "end": 1.0 } }
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 128], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 128], "tolerance": 0 }
}
},
{
"name": "rank3_axis1_two_merge_k128_8704",
"provenance": {
"notes": "Non-last-axis strided merge with firstCandidates 17*128=2176 past the one-merge chunk, so the two-level strided pipeline runs."
},
"attrs": { "axis": 1, "largest": 1, "sorted": 1 },
"args": { "k": 128 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 8704, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.0157, "cosStep": 0.0083, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 128, 4], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 128, 4], "tolerance": 0 }
}
},
{
"name": "int32_vocab_three_merge_k100_262144",
"provenance": {
"notes": "Distinct int32 ramp through the three-level merge (512 blocks -> 25 -> 2 chunks); exact order keys keep values above float24 precision honest."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 100 },
"inputs": {
"x": { "dtype": "int32", "shape": [1, 262144], "data": { "kind": "linspace", "start": -131072, "end": 131071 } }
},
"outputs": {
"values": { "dtype": "int32", "shape": [1, 100], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1, 100], "tolerance": 0 }
}
},
{
"name": "dsa_index_topk_2048_decode_16k",
"requires": { "limits": { "maxComputeWorkgroupStorageSize": 32768 } },
"provenance": {
"notes": "DeepSeek-V3.2 / AXK2 sparse-attention select step: index_topk defaults to 2048 in both configs. One query row against a 16K indexer key cache is the decode shape that co.huggingface.SparseAttentionScore feeds. The merge chunk is derived from k rather than fixed at MERGE_CHUNK_SIZE: a chunk no larger than k is a fixed point (each stage re-emits ceilDiv(candidates, chunk) * k), so the ladder never converged at k = 2048. Twice k halves the candidates per stage. That chunk needs 32 KiB of workgroup storage, which the case declares."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2048 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 16384],
"data": { "kind": "fillFloat32", "sinStep": 0.0131, "cosStep": 0.0237, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [1, 2048], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [1, 2048], "tolerance": 0 }
}
},
{
"name": "dsa_index_topk_2048_prefill_rows",
"requires": { "limits": { "maxComputeWorkgroupStorageSize": 32768 } },
"provenance": {
"notes": "Prefill form of the same select step: several query rows, each choosing 2048 of 4096 candidate keys. The merge chunk is derived from k rather than fixed at MERGE_CHUNK_SIZE: a chunk no larger than k is a fixed point (each stage re-emits ceilDiv(candidates, chunk) * k), so the ladder never converged at k = 2048. Twice k halves the candidates per stage. That chunk needs 32 KiB of workgroup storage, which the case declares."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 2048 },
"inputs": {
"x": {
"dtype": "float32",
"shape": [8, 4096],
"data": { "kind": "fillFloat32", "sinStep": 0.0131, "cosStep": 0.0237, "scale": 4.0 }
}
},
"outputs": {
"values": { "dtype": "float32", "shape": [8, 2048], "tolerance": 0.000001 },
"indices": { "dtype": "uint32", "shape": [8, 2048], "tolerance": 0 }
}
},
{
"name": "small_rows_batched_4096x32_k4_f16",
"provenance": {
"notes": "float16 twin for the batched small-rows rung: at least SMALL_ROWS_MIN_ROWS (4096) rows, an axis within SMALL_ROWS_MAX_AXIS (64) and k within SMALL_ROWS_MAX_K (8). The 33-value cycle is one longer than the axis, so every row is a rotation of the previous one and no row repeats a value, which leaves the top-4 indices unambiguous. Each value is a multiple of 1/64 and so is exact in float16."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float16",
"shape": [4096, 32],
"data": {
"kind": "cycle",
"values": [0.015625, 0.03125, 0.046875, 0.0625, 0.078125, 0.09375, 0.109375, 0.125, 0.140625, 0.15625, 0.171875, 0.1875, 0.203125, 0.21875, 0.234375, 0.25, 0.265625, 0.28125, 0.296875, 0.3125, 0.328125, 0.34375, 0.359375, 0.375, 0.390625, 0.40625, 0.421875, 0.4375, 0.453125, 0.46875, 0.484375, 0.5, 0.515625]
}
}
},
"outputs": {
"values": { "dtype": "float16", "shape": [4096, 4], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [4096, 4], "tolerance": 0 }
}
},
{
"name": "portable_rows_smallk_1025x128_k4_f16",
"provenance": {
"notes": "float16 twin for the portable small-k row rung, which takes an axis above SMALL_ROWS_MAX_AXIS (64) and within PORTABLE_ROWS_MAX_AXIS (256), and more than PORTABLE_ROWS_MIN (1024) rows. The 129-value cycle is one longer than the axis so each row is a rotation with no repeated value, and every value is a multiple of 1/256 and exact in float16."
},
"attrs": { "axis": -1, "largest": 1, "sorted": 1 },
"args": { "k": 4 },
"inputs": {
"x": {
"dtype": "float16",
"shape": [1025, 128],
"data": {
"kind": "cycle",
"values": [0.00390625, 0.0078125, 0.01171875, 0.015625, 0.01953125, 0.0234375, 0.02734375, 0.03125, 0.03515625, 0.0390625, 0.04296875, 0.046875, 0.05078125, 0.0546875, 0.05859375, 0.0625, 0.06640625, 0.0703125, 0.07421875, 0.078125, 0.08203125, 0.0859375, 0.08984375, 0.09375, 0.09765625, 0.1015625, 0.10546875, 0.109375, 0.11328125, 0.1171875, 0.12109375, 0.125, 0.12890625, 0.1328125, 0.13671875, 0.140625, 0.14453125, 0.1484375, 0.15234375, 0.15625, 0.16015625, 0.1640625, 0.16796875, 0.171875, 0.17578125, 0.1796875, 0.18359375, 0.1875, 0.19140625, 0.1953125, 0.19921875, 0.203125, 0.20703125, 0.2109375, 0.21484375, 0.21875, 0.22265625, 0.2265625, 0.23046875, 0.234375, 0.23828125, 0.2421875, 0.24609375, 0.25, 0.25390625, 0.2578125, 0.26171875, 0.265625, 0.26953125, 0.2734375, 0.27734375, 0.28125, 0.28515625, 0.2890625, 0.29296875, 0.296875, 0.30078125, 0.3046875, 0.30859375, 0.3125, 0.31640625, 0.3203125, 0.32421875, 0.328125, 0.33203125, 0.3359375, 0.33984375, 0.34375, 0.34765625, 0.3515625, 0.35546875, 0.359375, 0.36328125, 0.3671875, 0.37109375, 0.375, 0.37890625, 0.3828125, 0.38671875, 0.390625, 0.39453125, 0.3984375, 0.40234375, 0.40625, 0.41015625, 0.4140625, 0.41796875, 0.421875, 0.42578125, 0.4296875, 0.43359375, 0.4375, 0.44140625, 0.4453125, 0.44921875, 0.453125, 0.45703125, 0.4609375, 0.46484375, 0.46875, 0.47265625, 0.4765625, 0.48046875, 0.484375, 0.48828125, 0.4921875, 0.49609375, 0.5, 0.50390625]
}
}
},
"outputs": {
"values": { "dtype": "float16", "shape": [1025, 4], "tolerance": 0 },
"indices": { "dtype": "uint32", "shape": [1025, 4], "tolerance": 0 }
}
}
]
}