File size: 21,405 Bytes
d50509e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | {
"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 } }
}
]
}
|