File size: 21,157 Bytes
0f561dd | 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 | {
"op": "ai.onnx.NonZero",
"cases": [
{
"name": "int16_scalar_boundaries",
"inputs": {
"x": { "dtype": "int16", "shape": [4], "data": { "kind": "values", "values": [-32768, 0, 32767, -1] } }
},
"outputs": {
"y": { "dtype": "uint32", "shape": [1, 3], "tolerance": 0, "data": { "kind": "values", "values": [0, 2, 3] } }
}
},
{
"name": "rank2_exact_capacity_f32",
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.0, 1.0, 0.0, -2.0, 3.0, 0.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [2, 3] } }
},
{
"name": "f32_subnormal_nonzero_coordinates",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Subnormal finite values are nonzero under ONNX equality semantics; flushing them to zero changes the emitted coordinates."
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.0, 1e-40, -1e-40, 0.0, 1e-39, 0.0] }
}
},
"outputs": {
"y": {
"dtype": "uint32",
"shape": [2, 3],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 0, 1, 1, 2, 1] }
}
}
},
{
"name": "f32_scalar_subnormal_nonzero_coordinates",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.Scalar",
"notes": "A finite subnormal rank-0 input is still nonzero. ONNX represents its one hit with shape [0, 1], containing no coordinate values."
},
"inputs": { "x": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1e-40] } } },
"outputs": {
"y": { "dtype": "uint32", "shape": [0, 1], "tolerance": 0, "data": { "kind": "values", "values": [] } }
}
},
{
"name": "f32_parallel_subnormal_nonzero_coordinates",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Large enough to select the parallel-scan path; every even column is a finite subnormal and must produce an output coordinate."
},
"inputs": { "x": { "dtype": "float32", "shape": [1, 1026], "data": { "kind": "cycle", "values": [1e-40, 0.0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [2, 513], "tolerance": 0 } }
},
{
"name": "rank3_exact_capacity_uint8",
"inputs": {
"x": { "dtype": "uint8", "shape": [2, 2, 2], "data": { "kind": "values", "values": [1, 0, 2, 3, 0, 4, 5, 6] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [3, 6] } }
},
{
"name": "rank1_no_hits_int8",
"inputs": { "x": { "dtype": "int8", "shape": [4], "data": { "kind": "values", "values": [0, 0, 0, 0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [1, 0] } }
},
{
"name": "rank1_nonzero_int8",
"inputs": { "x": { "dtype": "int8", "shape": [4], "data": { "kind": "values", "values": [-2, 0, 7, 0] } } },
"outputs": {
"y": { "dtype": "uint32", "shape": [1, 2], "tolerance": 0, "data": { "kind": "values", "values": [0, 2] } }
},
"provenance": {
"notes": "Synthetic compact non-empty int8 witness for the standard numeric NonZero route; the existing int8 zero-hit case does not dispatch the dtype-specific shader path."
}
},
{
"name": "rank4_exact_capacity_f32",
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 3],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 0.0, 0.0, -3.0, 4.0, 0.0, 5.0, 6.0, 0.0, 7.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [4, 7] } }
},
{
"name": "ort_basic_numeric_rank3_exact_capacity_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "The runtime represents ONNX int64 coordinate metadata as uint32."
},
"inputs": {
"x": { "dtype": "int32", "shape": [1, 2, 3], "data": { "kind": "values", "values": [0, 1, 2, 0, 3, 4] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [3, 4], "tolerance": 0 } }
},
{
"name": "ort_basic_numeric_rank3_exact_capacity_float",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Float variant from ORT’s templated BasicNumeric case; the runtime represents ONNX int64 coordinate metadata as uint32."
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 3],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 0.0, 3.0, 4.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [3, 4], "tolerance": 0 } }
},
{
"name": "ort_three_dims_rank3_exact_capacity_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.ThreeDims",
"notes": "Integer-width adapted to int32; the runtime represents ONNX int64 coordinate metadata as uint32."
},
"inputs": {
"x": { "dtype": "int32", "shape": [2, 2, 2], "data": { "kind": "values", "values": [0, 1, 1, 0, 1, 0, 1, 0] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [3, 4], "tolerance": 0 } }
},
{
"name": "ort_empty_input_rank3_zero_hits",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.EmptyInput",
"notes": "Empty-input coverage with the exact ONNX output shape [rank(X), 0]."
},
"inputs": { "x": { "dtype": "int32", "shape": [1, 0, 2], "data": { "kind": "values", "values": [] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [3, 0], "tolerance": 0 } }
},
{
"name": "ort_basic_bool_adapted_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicBool",
"notes": "Integer twin of the boolean pattern: a [2,3] int32 0/1 tensor pins row-major coordinates for its two nonzero elements and the uint32 metadata output."
},
"inputs": {
"x": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 0, 0, 0, 0, 1] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [2, 2], "tolerance": 0 } }
},
{
"name": "ort_basic_bool_exact",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicBool"
},
"inputs": {
"x": { "dtype": "bool", "shape": [2, 3], "data": { "kind": "values", "values": [1, 0, 0, 0, 0, 1] } }
},
"outputs": {
"y": {
"dtype": "uint32",
"shape": [2, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 1, 0, 2] }
}
}
},
{
"name": "ort_scalar_zero_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.Scalar",
"notes": "Pins the ONNX scalar-zero output shape [0, 0]; the runtime represents ONNX int64 coordinate metadata as uint32."
},
"inputs": { "x": { "dtype": "int32", "shape": [], "data": { "kind": "values", "values": [0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [0, 0], "tolerance": 0 } }
},
{
"name": "ort_scalar_nonzero_int32",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.Scalar",
"notes": "Pins the ONNX scalar-nonzero output shape [0, 1]; the runtime represents ONNX int64 coordinate metadata as uint32."
},
"inputs": { "x": { "dtype": "int32", "shape": [], "data": { "kind": "values", "values": [1] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [0, 1], "tolerance": 0 } }
},
{
"name": "bool_scalar_nonzero",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.Scalar",
"notes": "Scalar NonZero shape convention from ORT's scalar case, using ONNX-valid bool input coverage from NonZeroOpTest.BasicBool."
},
"inputs": { "x": { "dtype": "bool", "shape": [], "data": { "kind": "values", "values": [1] } } },
"outputs": {
"y": { "dtype": "uint32", "shape": [0, 1], "tolerance": 0, "data": { "kind": "values", "values": [] } }
}
},
{
"name": "onnx_backend_nonzero_example",
"inputs": { "x": { "dtype": "int32", "shape": [2, 2], "data": { "kind": "values", "values": [1, 0, 1, 1] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [2, 3] } },
"provenance": {
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_nonzero_example",
"notes": "Official ONNX example with its exact dynamic output shape. The runtime represents ONNX int64 coordinate metadata as uint32."
}
},
{
"name": "float32_signed_zero_nan_and_infinity",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Additional numeric edge: +0 and -0 are zero, while NaN and infinities compare nonzero."
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.0, 0.0, "NaN", "Infinity", "-Infinity", 1.0] }
}
},
"outputs": {
"y": {
"dtype": "uint32",
"shape": [2, 4],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 1, 1, 1, 2, 0, 1, 2] }
}
}
},
{
"name": "float16_signed_zero_nan_exact_capacity",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Additional numeric edge: -0 is zero, while NaN and the finite nonzero value produce the two exact output coordinates."
},
"inputs": {
"x": { "dtype": "float16", "shape": [4], "data": { "kind": "values", "values": [0.0, "NaN", 0.0, -2.0] } }
},
"outputs": {
"y": { "dtype": "uint32", "shape": [1, 2], "tolerance": 0, "data": { "kind": "values", "values": [1, 3] } }
}
},
{
"name": "parallel_rank2_exact_capacity_f32",
"provenance": {
"notes": "65536-element rank-2 input with 25% nonzeros at exact capacity; exercises the parallel_scan 3-pass coordinate-emission variant."
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [256, 256],
"data": { "kind": "cycle", "values": [0.0, 0.0, 2.5, 0.0, -1.25, 0.0, 0.0, 0.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [2, 16384], "tolerance": 0 } }
},
{
"name": "parallel_rank1_f32_subnormal_nonzero",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Parallel-scan companion to the serial subnormal case: finite subnormal float32 values are nonzero and must survive the shared predicate scan."
},
"inputs": {
"x": { "dtype": "float32", "shape": [4096], "data": { "kind": "cycle", "values": [0.0, 1e-40, 0.0, -1e-40] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [1, 2048], "tolerance": 0 } }
},
{
"name": "parallel_rank1_exact_capacity_int32",
"provenance": {
"notes": "Exactly 10000 nonzeros; the parallel scatter must emit every coordinate into the caller-provided exact output shape."
},
"inputs": { "x": { "dtype": "int32", "shape": [50000], "data": { "kind": "cycle", "values": [0, 3, 0, 0, 0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [1, 10000], "tolerance": 0 } }
},
{
"name": "parallel_rank3_u32",
"provenance": {
"notes": "Rank-3 uint32 input; render-time stride unrolling must emit three coordinate rows at the scanned columns."
},
"inputs": {
"x": { "dtype": "uint32", "shape": [32, 60, 8], "data": { "kind": "cycle", "values": [7, 0, 0, 0, 1, 0] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [3, 5120], "tolerance": 0 } }
},
{
"name": "parallel_rank1_f16",
"provenance": {
"notes": "f16 input through the parallel predicate scan (f32-widened zero test, same as the serial kernel)."
},
"inputs": {
"x": { "dtype": "float16", "shape": [4096], "data": { "kind": "cycle", "values": [0.0, 1.5, 0.0, 0.0] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [1, 1024], "tolerance": 0 } }
},
{
"name": "f16_subnormal_nonzero_coordinates",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "The f16 predicate widens values to f32 before comparing with zero. The three finite f16 subnormals must therefore produce coordinates (0,1), (0,2), and (1,1), proving that widening preserves their nonzero values."
},
"inputs": {
"x": {
"dtype": "float16",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.0, 6e-8, -6e-8, 0.0, 0.00006, 0.0] }
}
},
"outputs": {
"y": {
"dtype": "uint32",
"shape": [2, 3],
"tolerance": 0,
"data": { "kind": "values", "values": [0, 0, 1, 1, 2, 1] }
}
}
},
{
"name": "parallel_f16_subnormal_nonzero_coordinates",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Parallel companion to the serial f16-subnormal case. Every even element rounds to the finite f16 subnormal 0x0001 and must survive the shared widened-f32 predicate, producing exactly 1024 coordinate columns."
},
"inputs": { "x": { "dtype": "float16", "shape": [2048], "data": { "kind": "cycle", "values": [6e-8, 0.0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [1, 1024], "tolerance": 0 } }
},
{
"name": "parallel_rank1_bool_mask",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicBool",
"notes": "Clean coverage: a sequence-scale boolean mask (the canonical real-model NonZero producer) through the parallel_scan path (numel>1024). bool maps to the u32 scalar with predicate `src[i] != 0u`; only the serial variant carried bool coverage before. ORT CPU NonZero(bool) and the TS reference agree on 1024 hits at the even columns."
},
"inputs": { "x": { "dtype": "bool", "shape": [2048], "data": { "kind": "cycle", "values": [1, 0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [1, 1024], "tolerance": 0 } }
},
{
"name": "parallel_rank2_uint8",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Clean coverage: rank-2 uint8 input through the parallel_scan path (numel>1024); uint8 maps to the u32 scalar with predicate `src[i] != 0u`. uint8 NonZero was only exercised by the tiny serial case before. ORT CPU NonZero(uint8) and the TS reference agree (every third element nonzero)."
},
"inputs": { "x": { "dtype": "uint8", "shape": [30, 50], "data": { "kind": "cycle", "values": [7, 0, 0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [2, 500], "tolerance": 0 } }
},
{
"name": "parallel_f32_signed_zero_nan_infinity",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/nonzero_op_test.cc",
"test": "NonZeroOpTest.BasicNumeric",
"notes": "Parallel companion to float32_signed_zero_nan_and_infinity. The flag scan bit-tests `(bitcast<u32>(src[i]) & 0x7fffffffu) != 0u`, so +0/-0 are zero while NaN and +/-Inf are nonzero; the six-value cycle produces exactly 1024 coordinate columns."
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [1536],
"data": { "kind": "cycle", "values": [0.0, 0.0, "NaN", "Infinity", "-Infinity", 1.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [1, 1024], "tolerance": 0 } }
},
{
"name": "parallel_rank6_max_rank_stride_unroll",
"provenance": {
"notes": "Six-dimensional int32 input through the parallel path. This exercises six compile-time coordinate strides and emits six coordinate rows; the [3,0,0,0] cycle produces 512 deterministic columns in row-major order."
},
"inputs": {
"x": { "dtype": "int32", "shape": [2, 2, 2, 2, 2, 64], "data": { "kind": "cycle", "values": [3, 0, 0, 0] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [6, 512], "tolerance": 0 } }
},
{
"name": "parallel_rank4_vec4_tail_scan_scatter",
"provenance": {
"notes": "Compact route lock for the rank-4 activation-map benchmark. 1536 elements cross one 1024-element vectorized block boundary; the 50% mask validates stable flattened order, rank-4 coordinate decomposition, and the partial second block."
},
"inputs": { "x": { "dtype": "uint32", "shape": [2, 3, 8, 32], "data": { "kind": "cycle", "values": [0, 7] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [4, 768], "tolerance": 0 } }
},
{
"name": "parallel_rank1_exact_crossover_1024",
"provenance": {
"notes": "Pins the first profitable parallel-scan size. Exactly 1024 elements form one complete vectorized scan block; the alternating mask validates stable coordinates and an exact 512-column output at the serial/parallel selector boundary."
},
"inputs": { "x": { "dtype": "float32", "shape": [1024], "data": { "kind": "cycle", "values": [0.0, 3.0] } } },
"outputs": { "y": { "dtype": "uint32", "shape": [1, 512], "tolerance": 0 } }
},
{
"name": "rank7_exact_capacity_coordinates",
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 1, 2, 1, 2, 3],
"data": { "kind": "cycle", "values": [0.0, 1.0, 0.0, -2.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [7, 12], "tolerance": 0 } }
},
{
"name": "parallel_sparse_exact_capacity_2048",
"provenance": {
"notes": "Sparse parallel-route fixture with 512 deterministic hits and an exact [1, 512] output shape."
},
"inputs": {
"x": { "dtype": "float32", "shape": [2048], "data": { "kind": "cycle", "values": [0.0, 3.0, 0.0, 0.0] } }
},
"outputs": { "y": { "dtype": "uint32", "shape": [1, 512], "tolerance": 0 } }
},
{
"name": "rank8_exact_capacity_coordinates",
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 1, 2, 1, 2, 2, 3],
"data": { "kind": "cycle", "values": [0.0, 1.0, 0.0, -2.0] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [8, 24], "tolerance": 0 } }
},
{
"name": "parallel_rank4_wide_items_scan",
"provenance": {
"notes": "Large enough (524288 elements, 512 scan blocks) to take the wide items-per-thread branch, which for rank >= 4 resolves to 4. Every other parallel fixture is small enough to fall to the narrow 16-item branch, so without this the 4-item scan and scatter were exercised only by benchmarks, which do not check output."
},
"inputs": {
"x": {
"dtype": "uint32",
"shape": [4, 8, 128, 128],
"data": { "kind": "cycle", "values": [0, 0, 0, 0, 0, 0, 0, 7] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [4, 65536], "tolerance": 0 } }
},
{
"name": "parallel_rank3_wide_items_scan",
"provenance": {
"notes": "Rank-3 twin of parallel_rank4_wide_items_scan: 1048576 elements is 512 scan blocks at the rank-3 wide value of 8 items per thread, the other items-per-thread value no smaller fixture reaches."
},
"inputs": {
"x": {
"dtype": "uint32",
"shape": [8, 128, 1024],
"data": { "kind": "cycle", "values": [0, 0, 0, 0, 0, 0, 0, 7] }
}
},
"outputs": { "y": { "dtype": "uint32", "shape": [3, 131072], "tolerance": 0 } }
}
]
}
|