Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
d50509e verified
Raw
History Blame
21.4 kB
{
"op": "ai.onnx.Compress",
"cases": [
{
"name": "int16_axis_copy_boundaries",
"attrs": { "axis": 0 },
"inputs": {
"input": {
"dtype": "int16",
"shape": [4, 2],
"data": { "kind": "values", "values": [-32768, 32767, -1, 0, 1, -2, 32766, -32767] }
},
"condition": { "dtype": "bool", "shape": [4], "data": { "kind": "values", "values": [1, 0, 1, 1] } }
},
"outputs": {
"output": {
"dtype": "int16",
"shape": [3, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [-32768, 32767, 1, -2, 32766, -32767] }
}
}
},
{
"name": "flatten_vit_token_prune_parallel_threshold",
"inputs": {
"input": { "dtype": "float32", "shape": [768], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } },
"condition": { "dtype": "bool", "shape": [768], "data": { "kind": "cycle", "values": [1, 0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [384], "tolerance": 0 } }
},
{
"name": "axis0_f32",
"attrs": { "axis": 0 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"condition": { "dtype": "bool", "shape": [3], "data": { "kind": "values", "values": [0, 1, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 2] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress0"
}
},
{
"name": "axis1_f32",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 1] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress1"
}
},
{
"name": "axis1_3d_f32",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_3dims"
}
},
{
"name": "ort_axis1_long_condition_parallel_scan_compaction",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_3dims",
"notes": "Extends ORT's axis=1 3D case to a long axis with a nontrivial true/false pattern so the WebGPU axis parallel prefix-scan path is exercised."
},
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 1030, 2],
"data": { "kind": "linspace", "start": 0.0, "end": 4119.0 }
},
"condition": { "dtype": "bool", "shape": [1030], "data": { "kind": "cycle", "values": [1, 0, 1, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 772, 2], "tolerance": 0 } }
},
{
"name": "all_false_zero_axis_dim",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 0, 3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_condition_all_false"
}
},
{
"name": "extra_condition_ignored",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
},
"condition": { "dtype": "bool", "shape": [3], "data": { "kind": "values", "values": [0, 1, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_3dims_has_extra_condition"
}
},
{
"name": "short_condition_ignores_extra_input_axis_values",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 3, 3],
"data": {
"kind": "values",
"values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0]
}
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_3dims_has_extra_input"
}
},
{
"name": "default_axis_flatten_f32",
"inputs": {
"input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"condition": { "dtype": "bool", "shape": [5], "data": { "kind": "values", "values": [0, 1, 0, 0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_default_axis"
}
},
{
"name": "ort_default_axis_all_true_parallel_scan_over_1024",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_default_axis_issue_9247_cumulative_sum_overflow",
"notes": "Extends ORT's >127-element cumulative-sum regression above 1024 elements so the WebGPU parallel prefix-scan path is exercised."
},
"inputs": {
"input": { "dtype": "float32", "shape": [23, 50], "data": { "kind": "linspace", "start": 0.0, "end": 1149.0 } },
"condition": { "dtype": "bool", "shape": [1150], "data": { "kind": "constant", "value": 1 } }
},
"outputs": { "output": { "dtype": "float32", "shape": [1150], "tolerance": 0 } }
},
{
"name": "negative_axis_f32",
"attrs": { "axis": -2 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3] } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_3dims_neg_axis"
}
},
{
"name": "axis0_uint32",
"attrs": { "axis": 0 },
"inputs": {
"input": { "dtype": "uint32", "shape": [3, 2], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } },
"condition": { "dtype": "bool", "shape": [3], "data": { "kind": "values", "values": [1, 0, 1] } }
},
"outputs": { "output": { "dtype": "uint32", "shape": [2, 2] } }
},
{
"name": "axis1_f16",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float16",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"condition": { "dtype": "bool", "shape": [3], "data": { "kind": "values", "values": [1, 0, 1] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [2, 2] } },
"tolerance": 0.001
},
{
"name": "ort_default_axis_issue_9247_all_true_150",
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 75],
"data": { "kind": "fillFloat32", "sinStep": 0.07, "cosStep": 0.11, "scale": 1.0 }
},
"condition": { "dtype": "bool", "shape": [150], "data": { "kind": "constant", "value": 1 } }
},
"outputs": { "output": { "dtype": "float32", "shape": [150], "tolerance": 0 } },
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_default_axis_issue_9247_cumulative_sum_overflow"
}
},
{
"name": "onnx_backend_compress_negative_axis",
"attrs": { "axis": -1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 1] } },
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_compress_negative_axis" }
},
{
"name": "parallel_flatten_exact_output_f32",
"provenance": {
"notes": "262144 flattened elements with an alternating condition exercise the three-pass scan with the exact 131072-element ONNX output extent."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [512, 512],
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.29 }
},
"condition": { "dtype": "bool", "shape": [262144], "data": { "kind": "cycle", "values": [1, 0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [131072], "tolerance": 0 } }
},
{
"name": "parallel_flatten_condition_shorter_u32",
"provenance": {
"notes": "Condition shorter than the flattened input: the scan limit is min(inputCount, conditionCount) = 3000 and trailing input elements are dropped."
},
"inputs": {
"input": { "dtype": "uint32", "shape": [8192], "data": { "kind": "cycle", "values": [5, 7, 11, 2, 9] } },
"condition": { "dtype": "bool", "shape": [3000], "data": { "kind": "cycle", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "uint32", "shape": [1500] } }
},
{
"name": "parallel_axis1_3d_f32",
"attrs": { "axis": 1 },
"provenance": {
"notes": "Middle-axis parallel compress: the scan runs over 300 axis flags and the scatter covers all 76800 elements in parallel."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [64, 300, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.23 }
},
"condition": { "dtype": "bool", "shape": [300], "data": { "kind": "cycle", "values": [1, 0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [64, 200, 4], "tolerance": 0 } }
},
{
"name": "parallel_axis_negative_f16",
"attrs": { "axis": -2 },
"provenance": {
"notes": "Negative axis + f16 payload + condition shorter than the axis (1024 < 2048); axis positions past the condition are dropped."
},
"inputs": {
"input": {
"dtype": "float16",
"shape": [2, 2048, 4],
"data": { "kind": "cycle", "values": [0.5, 1.5, -2.0, 3.0] }
},
"condition": { "dtype": "bool", "shape": [1024], "data": { "kind": "cycle", "values": [1, 0, 0, 1] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [2, 512, 4], "tolerance": 0 } }
},
{
"name": "parallel_axis0_condition_extra_f32",
"attrs": { "axis": 0 },
"provenance": {
"notes": "Condition longer than the axis (2000 > 1500); extra condition entries are ignored. 900 of 1500 rows selected."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [1500, 8],
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.41 }
},
"condition": { "dtype": "bool", "shape": [2000], "data": { "kind": "cycle", "values": [1, 0, 1, 0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [900, 8], "tolerance": 0 } }
},
{
"name": "ort_bool_exact_condition_default_axis",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_default_axis"
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"condition": { "dtype": "bool", "shape": [5], "data": { "kind": "values", "values": [0, 1, 0, 0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2], "tolerance": 0 } }
},
{
"name": "ort_bool_exact_condition_negative_axis",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_3dims_neg_axis",
"notes": "Exact ORT negative-axis fixture with an ONNX bool condition."
},
"attrs": { "axis": -2 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3], "tolerance": 0 } }
},
{
"name": "bool_payload_axis1",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress1",
"notes": "Same axis=1 compaction pattern as ORT's fixture, using ONNX-valid bool payload tensors."
},
"attrs": { "axis": 1 },
"inputs": {
"input": { "dtype": "bool", "shape": [2, 3], "data": { "kind": "values", "values": [1, 0, 1, 0, 1, 0] } },
"condition": { "dtype": "bool", "shape": [3], "data": { "kind": "values", "values": [1, 0, 1] } }
},
"outputs": { "output": { "dtype": "bool", "shape": [2, 2], "tolerance": 0 } }
},
{
"name": "bool_payload_axis1_all_false_zero_dim",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/compress_op.test.cc",
"test": "CompressTest.Compress_condition_all_false",
"notes": "All-false axis condition from ORT's zero-output case, using ONNX-valid bool payload tensors."
},
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "bool",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1] }
},
"condition": { "dtype": "bool", "shape": [2], "data": { "kind": "values", "values": [0, 0] } }
},
"outputs": { "output": { "dtype": "bool", "shape": [2, 0, 3], "tolerance": 0 } }
},
{
"name": "int8_payload_axis1_parallel_scatter",
"provenance": {
"notes": "int8 activation payload through the axis_parallel_scan scatter (numel 12288 > 1024). int8 stores as i32 per scalarType, so the $scalar copy path is exercised with the full s8 range incl -128/127. ORT CPU runs Compress for int8."
},
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "int8",
"shape": [16, 96, 8],
"data": { "kind": "cycle", "values": [-128, -1, 0, 1, 127, 42, -77, 5] }
},
"condition": { "dtype": "bool", "shape": [96], "data": { "kind": "cycle", "values": [1, 0, 1] } }
},
"outputs": { "output": { "dtype": "int8", "shape": [16, 64, 8], "tolerance": 0 } }
},
{
"name": "uint8_payload_flatten_parallel_scatter",
"provenance": {
"notes": "uint8 payload through flatten_parallel_scan (numel 4096 > 1024). uint8 widens to u32; covers the full 0..255 range through the 3-pass predicate-scan scatter. ORT CPU runs Compress for uint8."
},
"inputs": {
"input": {
"dtype": "uint8",
"shape": [4096],
"data": { "kind": "cycle", "values": [0, 1, 127, 128, 200, 255] }
},
"condition": { "dtype": "bool", "shape": [4096], "data": { "kind": "cycle", "values": [1, 1, 0, 1] } }
},
"outputs": { "output": { "dtype": "uint8", "shape": [3072], "tolerance": 0 } }
},
{
"name": "int32_large_magnitude_above_2pow24_flatten",
"provenance": {
"notes": "int32 payload with magnitudes above 2^24 (incl ±2e9) through flatten_parallel_scan. Verifies the i32 scatter copy preserves values that would be lossy if carried through f32; comparison uses the int32 dtype so it stays exact. ORT CPU runs Compress for int32."
},
"inputs": {
"input": {
"dtype": "int32",
"shape": [4096],
"data": { "kind": "cycle", "values": [16777217, 33554433, -100000000, 2000000000, -2000000000, 16777216] }
},
"condition": { "dtype": "bool", "shape": [4096], "data": { "kind": "cycle", "values": [1, 0] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [2048], "tolerance": 0 } }
},
{
"name": "int32_axis0_serial_fallback",
"provenance": {
"notes": "int32 payload, axis=0, and a compact input select the serial axis kernel. Large-magnitude values confirm the single-lane copy is exact for i32; ORT CPU runs Compress for int32."
},
"attrs": { "axis": 0 },
"inputs": {
"input": {
"dtype": "int32",
"shape": [16, 8],
"data": { "kind": "cycle", "values": [100000000, -100000000, 7, -7] }
},
"condition": { "dtype": "bool", "shape": [16], "data": { "kind": "cycle", "values": [1, 0, 1, 1] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [12, 8], "tolerance": 0 } }
},
{
"name": "bool_condition_axis0_selectable",
"provenance": { "notes": "Bool condition selects the first and last slices along axis 0." },
"attrs": { "axis": 0 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [4, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
},
"condition": { "dtype": "bool", "shape": [4], "data": { "kind": "values", "values": [1, 0, 1, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 3], "tolerance": 0 } }
},
{
"name": "bool_payload_flatten_parallel_scan_2048",
"inputs": {
"input": { "dtype": "bool", "shape": [64, 32], "data": { "kind": "cycle", "values": [1, 0, 1, 1, 0, 1, 0, 0] } },
"condition": { "dtype": "bool", "shape": [2048], "data": { "kind": "cycle", "values": [1, 0] } }
},
"outputs": { "output": { "dtype": "bool", "shape": [1024], "tolerance": 0 } }
},
{
"name": "int32_axis_last_serial",
"attrs": { "axis": -1 },
"inputs": {
"input": {
"dtype": "int32",
"shape": [3, 4],
"data": { "kind": "values", "values": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120] }
},
"condition": { "dtype": "bool", "shape": [4], "data": { "kind": "values", "values": [1, 0, 1, 0] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [3, 2], "tolerance": 0 } }
},
{
"name": "int8_axis1_parallel_condition_shorter_than_axisDim",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "int8",
"shape": [4, 96, 4],
"data": { "kind": "cycle", "values": [-128, -1, 0, 1, 127, 42, -77, 5] }
},
"condition": { "dtype": "bool", "shape": [32], "data": { "kind": "cycle", "values": [1, 0, 0, 1] } }
},
"outputs": { "output": { "dtype": "int8", "shape": [4, 16, 4], "tolerance": 0 } }
},
{
"name": "rank8_axis1",
"attrs": { "axis": 1 },
"inputs": {
"input": {
"dtype": "float32",
"shape": [2, 3, 1, 1, 1, 1, 2, 2],
"data": { "kind": "linspace", "start": 1.0, "end": 48.0 }
},
"condition": { "dtype": "bool", "shape": [3], "data": { "kind": "values", "values": [1, 0, 1] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [2, 2, 1, 1, 1, 1, 2, 2], "tolerance": 0 } }
}
]
}