reduce_min.https.any.js (36397B)
1 // META: title=test WebNN API reduction operations 2 // META: global=window 3 // META: variant=?cpu 4 // META: variant=?gpu 5 // META: variant=?npu 6 // META: script=../resources/utils.js 7 // META: timeout=long 8 9 'use strict'; 10 11 // https://www.w3.org/TR/webnn/#dom-mlgraphbuilder-reducemin 12 // Reduce the input tensor along all dimensions, or along the axes specified in 13 // the axes array parameter. 14 // 15 // dictionary MLReduceOptions { 16 // sequence<[EnforceRange] unsigned long> axes; 17 // boolean keepDimensions = false; 18 // }; 19 // 20 // MLOperand reduceMin(MLOperand input, optional MLReduceOptions options = {}); 21 22 const reduceMinTests = [ 23 { 24 'name': 'reduceMin float32 0D constant tensor default options', 25 'graph': { 26 'inputs': { 27 'reduceMinInput': { 28 'data': [-58.76195526123047], 29 'descriptor': {shape: [], dataType: 'float32'}, 30 'constant': true 31 } 32 }, 33 'operators': [{ 34 'name': 'reduceMin', 35 'arguments': [{'input': 'reduceMinInput'}], 36 'outputs': 'reduceMinOutput' 37 }], 38 'expectedOutputs': { 39 'reduceMinOutput': { 40 'data': -58.76195526123047, 41 'descriptor': {shape: [], dataType: 'float32'} 42 } 43 } 44 } 45 }, 46 { 47 'name': 'reduceMin float32 0D tensor default options', 48 'graph': { 49 'inputs': { 50 'reduceMinInput': { 51 'data': [-58.76195526123047], 52 'descriptor': {shape: [], dataType: 'float32'}, 53 'constant': false 54 } 55 }, 56 'operators': [{ 57 'name': 'reduceMin', 58 'arguments': [{'input': 'reduceMinInput'}], 59 'outputs': 'reduceMinOutput' 60 }], 61 'expectedOutputs': { 62 'reduceMinOutput': { 63 'data': -58.76195526123047, 64 'descriptor': {shape: [], dataType: 'float32'} 65 } 66 } 67 } 68 }, 69 { 70 'name': 'reduceMin float32 0D constant tensor empty axes', 71 'graph': { 72 'inputs': { 73 'reduceMinInput': { 74 'data': [-58.76195526123047], 75 'descriptor': {shape: [], dataType: 'float32'}, 76 'constant': true 77 } 78 }, 79 'operators': [{ 80 'name': 'reduceMin', 81 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], 82 'outputs': 'reduceMinOutput' 83 }], 84 'expectedOutputs': { 85 'reduceMinOutput': { 86 'data': -58.76195526123047, 87 'descriptor': {shape: [], dataType: 'float32'} 88 } 89 } 90 } 91 }, 92 { 93 'name': 'reduceMin float32 0D tensor empty axes', 94 'graph': { 95 'inputs': { 96 'reduceMinInput': { 97 'data': [-58.76195526123047], 98 'descriptor': {shape: [], dataType: 'float32'}, 99 'constant': false 100 } 101 }, 102 'operators': [{ 103 'name': 'reduceMin', 104 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], 105 'outputs': 'reduceMinOutput' 106 }], 107 'expectedOutputs': { 108 'reduceMinOutput': { 109 'data': -58.76195526123047, 110 'descriptor': {shape: [], dataType: 'float32'} 111 } 112 } 113 } 114 }, 115 { 116 'name': 'reduceMin float32 1D constant tensor empty axes', 117 'graph': { 118 'inputs': { 119 'reduceMinInput': { 120 'data': [-58.76195526123047, 58.76195526123047], 121 'descriptor': {shape: [2], dataType: 'float32'}, 122 'constant': true 123 } 124 }, 125 'operators': [{ 126 'name': 'reduceMin', 127 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], 128 'outputs': 'reduceMinOutput' 129 }], 130 'expectedOutputs': { 131 'reduceMinOutput': { 132 'data': [-58.76195526123047, 58.76195526123047], 133 'descriptor': {shape: [2], dataType: 'float32'} 134 } 135 } 136 } 137 }, 138 { 139 'name': 'reduceMin float32 1D constant tensor default options', 140 'graph': { 141 'inputs': { 142 'reduceMinInput': { 143 'data': [ 144 -58.76195526123047, -87.9623031616211, -70.13690185546875, 145 -53.61766815185547, -39.50931167602539, 76.48815155029297, 146 -18.705087661743164, 44.78261947631836, 30.70233917236328, 147 61.46361541748047, 77.84043884277344, -53.747413635253906, 148 -31.713542938232422, -9.735438346862793, 77.9365234375, 149 99.01705932617188, 73.39929962158203, 92.0845947265625, 150 -59.40851974487305, -84.4076919555664, 75.88834381103516, 151 96.02651977539062, -55.97655487060547, -1.7911018133163452 152 ], 153 'descriptor': {shape: [24], dataType: 'float32'}, 154 'constant': true 155 } 156 }, 157 'operators': [{ 158 'name': 'reduceMin', 159 'arguments': [{'input': 'reduceMinInput'}], 160 'outputs': 'reduceMinOutput' 161 }], 162 'expectedOutputs': { 163 'reduceMinOutput': { 164 'data': -87.9623031616211, 165 'descriptor': {shape: [], dataType: 'float32'} 166 } 167 } 168 } 169 }, 170 { 171 'name': 'reduceMin float32 1D tensor default options', 172 'graph': { 173 'inputs': { 174 'reduceMinInput': { 175 'data': [ 176 -58.76195526123047, -87.9623031616211, -70.13690185546875, 177 -53.61766815185547, -39.50931167602539, 76.48815155029297, 178 -18.705087661743164, 44.78261947631836, 30.70233917236328, 179 61.46361541748047, 77.84043884277344, -53.747413635253906, 180 -31.713542938232422, -9.735438346862793, 77.9365234375, 181 99.01705932617188, 73.39929962158203, 92.0845947265625, 182 -59.40851974487305, -84.4076919555664, 75.88834381103516, 183 96.02651977539062, -55.97655487060547, -1.7911018133163452 184 ], 185 'descriptor': {shape: [24], dataType: 'float32'} 186 } 187 }, 188 'operators': [{ 189 'name': 'reduceMin', 190 'arguments': [{'input': 'reduceMinInput'}], 191 'outputs': 'reduceMinOutput' 192 }], 193 'expectedOutputs': { 194 'reduceMinOutput': { 195 'data': -87.9623031616211, 196 'descriptor': {shape: [], dataType: 'float32'} 197 } 198 } 199 } 200 }, 201 { 202 'name': 'reduceMin float32 2D tensor default options', 203 'graph': { 204 'inputs': { 205 'reduceMinInput': { 206 'data': [ 207 -58.76195526123047, -87.9623031616211, -70.13690185546875, 208 -53.61766815185547, -39.50931167602539, 76.48815155029297, 209 -18.705087661743164, 44.78261947631836, 30.70233917236328, 210 61.46361541748047, 77.84043884277344, -53.747413635253906, 211 -31.713542938232422, -9.735438346862793, 77.9365234375, 212 99.01705932617188, 73.39929962158203, 92.0845947265625, 213 -59.40851974487305, -84.4076919555664, 75.88834381103516, 214 96.02651977539062, -55.97655487060547, -1.7911018133163452 215 ], 216 'descriptor': {shape: [4, 6], dataType: 'float32'} 217 } 218 }, 219 'operators': [{ 220 'name': 'reduceMin', 221 'arguments': [{'input': 'reduceMinInput'}], 222 'outputs': 'reduceMinOutput' 223 }], 224 'expectedOutputs': { 225 'reduceMinOutput': { 226 'data': -87.9623031616211, 227 'descriptor': {shape: [], dataType: 'float32'} 228 } 229 } 230 } 231 }, 232 { 233 'name': 'reduceMin float32 3D tensor default options', 234 'graph': { 235 'inputs': { 236 'reduceMinInput': { 237 'data': [ 238 -58.76195526123047, -87.9623031616211, -70.13690185546875, 239 -53.61766815185547, -39.50931167602539, 76.48815155029297, 240 -18.705087661743164, 44.78261947631836, 30.70233917236328, 241 61.46361541748047, 77.84043884277344, -53.747413635253906, 242 -31.713542938232422, -9.735438346862793, 77.9365234375, 243 99.01705932617188, 73.39929962158203, 92.0845947265625, 244 -59.40851974487305, -84.4076919555664, 75.88834381103516, 245 96.02651977539062, -55.97655487060547, -1.7911018133163452 246 ], 247 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 248 } 249 }, 250 'operators': [{ 251 'name': 'reduceMin', 252 'arguments': [{'input': 'reduceMinInput'}], 253 'outputs': 'reduceMinOutput' 254 }], 255 'expectedOutputs': { 256 'reduceMinOutput': { 257 'data': -87.9623031616211, 258 'descriptor': {shape: [], dataType: 'float32'} 259 } 260 } 261 } 262 }, 263 { 264 'name': 'reduceMin float32 4D tensor default options', 265 'graph': { 266 'inputs': { 267 'reduceMinInput': { 268 'data': [ 269 -58.76195526123047, -87.9623031616211, -70.13690185546875, 270 -53.61766815185547, -39.50931167602539, 76.48815155029297, 271 -18.705087661743164, 44.78261947631836, 30.70233917236328, 272 61.46361541748047, 77.84043884277344, -53.747413635253906, 273 -31.713542938232422, -9.735438346862793, 77.9365234375, 274 99.01705932617188, 73.39929962158203, 92.0845947265625, 275 -59.40851974487305, -84.4076919555664, 75.88834381103516, 276 96.02651977539062, -55.97655487060547, -1.7911018133163452 277 ], 278 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 279 } 280 }, 281 'operators': [{ 282 'name': 'reduceMin', 283 'arguments': [{'input': 'reduceMinInput'}], 284 'outputs': 'reduceMinOutput' 285 }], 286 'expectedOutputs': { 287 'reduceMinOutput': { 288 'data': -87.9623031616211, 289 'descriptor': {shape: [], dataType: 'float32'} 290 } 291 } 292 } 293 }, 294 { 295 'name': 'reduceMin float32 5D tensor default options', 296 'graph': { 297 'inputs': { 298 'reduceMinInput': { 299 'data': [ 300 -58.76195526123047, -87.9623031616211, -70.13690185546875, 301 -53.61766815185547, -39.50931167602539, 76.48815155029297, 302 -18.705087661743164, 44.78261947631836, 30.70233917236328, 303 61.46361541748047, 77.84043884277344, -53.747413635253906, 304 -31.713542938232422, -9.735438346862793, 77.9365234375, 305 99.01705932617188, 73.39929962158203, 92.0845947265625, 306 -59.40851974487305, -84.4076919555664, 75.88834381103516, 307 96.02651977539062, -55.97655487060547, -1.7911018133163452 308 ], 309 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float32'} 310 } 311 }, 312 'operators': [{ 313 'name': 'reduceMin', 314 'arguments': [{'input': 'reduceMinInput'}], 315 'outputs': 'reduceMinOutput' 316 }], 317 'expectedOutputs': { 318 'reduceMinOutput': { 319 'data': -87.9623031616211, 320 'descriptor': {shape: [], dataType: 'float32'} 321 } 322 } 323 } 324 }, 325 { 326 'name': 'reduceMin float32 3D tensor options.axes', 327 'graph': { 328 'inputs': { 329 'reduceMinInput': { 330 'data': [ 331 -58.76195526123047, -87.9623031616211, -70.13690185546875, 332 -53.61766815185547, -39.50931167602539, 76.48815155029297, 333 -18.705087661743164, 44.78261947631836, 30.70233917236328, 334 61.46361541748047, 77.84043884277344, -53.747413635253906, 335 -31.713542938232422, -9.735438346862793, 77.9365234375, 336 99.01705932617188, 73.39929962158203, 92.0845947265625, 337 -59.40851974487305, -84.4076919555664, 75.88834381103516, 338 96.02651977539062, -55.97655487060547, -1.7911018133163452 339 ], 340 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 341 } 342 }, 343 'operators': [{ 344 'name': 'reduceMin', 345 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': [2]}}], 346 'outputs': 'reduceMinOutput' 347 }], 348 'expectedOutputs': { 349 'reduceMinOutput': { 350 'data': [ 351 -87.9623031616211, -39.50931167602539, -53.747413635253906, 352 -31.713542938232422, -84.4076919555664, -55.97655487060547 353 ], 354 'descriptor': {shape: [2, 3], dataType: 'float32'} 355 } 356 } 357 } 358 }, 359 { 360 'name': 'reduceMin float32 4D tensor options.axes', 361 'graph': { 362 'inputs': { 363 'reduceMinInput': { 364 'data': [ 365 -58.76195526123047, -87.9623031616211, -70.13690185546875, 366 -53.61766815185547, -39.50931167602539, 76.48815155029297, 367 -18.705087661743164, 44.78261947631836, 30.70233917236328, 368 61.46361541748047, 77.84043884277344, -53.747413635253906, 369 -31.713542938232422, -9.735438346862793, 77.9365234375, 370 99.01705932617188, 73.39929962158203, 92.0845947265625, 371 -59.40851974487305, -84.4076919555664, 75.88834381103516, 372 96.02651977539062, -55.97655487060547, -1.7911018133163452 373 ], 374 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 375 } 376 }, 377 'operators': [{ 378 'name': 'reduceMin', 379 'arguments': 380 [{'input': 'reduceMinInput'}, {'options': {'axes': [0, 2]}}], 381 'outputs': 'reduceMinOutput' 382 }], 383 'expectedOutputs': { 384 'reduceMinOutput': { 385 'data': [ 386 -58.76195526123047, -87.9623031616211, -70.13690185546875, 387 -59.40851974487305, -84.4076919555664, -53.747413635253906 388 ], 389 'descriptor': {shape: [2, 3], dataType: 'float32'} 390 } 391 } 392 } 393 }, 394 { 395 'name': 'reduceMin float32 3D tensor options.keepDimensions=false', 396 'graph': { 397 'inputs': { 398 'reduceMinInput': { 399 'data': [ 400 -58.76195526123047, -87.9623031616211, -70.13690185546875, 401 -53.61766815185547, -39.50931167602539, 76.48815155029297, 402 -18.705087661743164, 44.78261947631836, 30.70233917236328, 403 61.46361541748047, 77.84043884277344, -53.747413635253906, 404 -31.713542938232422, -9.735438346862793, 77.9365234375, 405 99.01705932617188, 73.39929962158203, 92.0845947265625, 406 -59.40851974487305, -84.4076919555664, 75.88834381103516, 407 96.02651977539062, -55.97655487060547, -1.7911018133163452 408 ], 409 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 410 } 411 }, 412 'operators': [{ 413 'name': 'reduceMin', 414 'arguments': [ 415 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} 416 ], 417 'outputs': 'reduceMinOutput' 418 }], 419 'expectedOutputs': { 420 'reduceMinOutput': { 421 'data': -87.9623031616211, 422 'descriptor': {shape: [], dataType: 'float32'} 423 } 424 } 425 } 426 }, 427 { 428 'name': 'reduceMin float32 3D tensor options.keepDimensions=true', 429 'graph': { 430 'inputs': { 431 'reduceMinInput': { 432 'data': [ 433 -58.76195526123047, -87.9623031616211, -70.13690185546875, 434 -53.61766815185547, -39.50931167602539, 76.48815155029297, 435 -18.705087661743164, 44.78261947631836, 30.70233917236328, 436 61.46361541748047, 77.84043884277344, -53.747413635253906, 437 -31.713542938232422, -9.735438346862793, 77.9365234375, 438 99.01705932617188, 73.39929962158203, 92.0845947265625, 439 -59.40851974487305, -84.4076919555664, 75.88834381103516, 440 96.02651977539062, -55.97655487060547, -1.7911018133163452 441 ], 442 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 443 } 444 }, 445 'operators': [{ 446 'name': 'reduceMin', 447 'arguments': [ 448 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} 449 ], 450 'outputs': 'reduceMinOutput' 451 }], 452 'expectedOutputs': { 453 'reduceMinOutput': { 454 'data': [-87.9623031616211], 455 'descriptor': {shape: [1, 1, 1], dataType: 'float32'} 456 } 457 } 458 } 459 }, 460 { 461 'name': 'reduceMin float32 4D tensor options.keepDimensions=false', 462 'graph': { 463 'inputs': { 464 'reduceMinInput': { 465 'data': [ 466 -58.76195526123047, -87.9623031616211, -70.13690185546875, 467 -53.61766815185547, -39.50931167602539, 76.48815155029297, 468 -18.705087661743164, 44.78261947631836, 30.70233917236328, 469 61.46361541748047, 77.84043884277344, -53.747413635253906, 470 -31.713542938232422, -9.735438346862793, 77.9365234375, 471 99.01705932617188, 73.39929962158203, 92.0845947265625, 472 -59.40851974487305, -84.4076919555664, 75.88834381103516, 473 96.02651977539062, -55.97655487060547, -1.7911018133163452 474 ], 475 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 476 } 477 }, 478 'operators': [{ 479 'name': 'reduceMin', 480 'arguments': [ 481 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} 482 ], 483 'outputs': 'reduceMinOutput' 484 }], 485 'expectedOutputs': { 486 'reduceMinOutput': { 487 'data': -87.9623031616211, 488 'descriptor': {shape: [], dataType: 'float32'} 489 } 490 } 491 } 492 }, 493 { 494 'name': 'reduceMin float32 4D tensor options.keepDimensions=true', 495 'graph': { 496 'inputs': { 497 'reduceMinInput': { 498 'data': [ 499 -58.76195526123047, -87.9623031616211, -70.13690185546875, 500 -53.61766815185547, -39.50931167602539, 76.48815155029297, 501 -18.705087661743164, 44.78261947631836, 30.70233917236328, 502 61.46361541748047, 77.84043884277344, -53.747413635253906, 503 -31.713542938232422, -9.735438346862793, 77.9365234375, 504 99.01705932617188, 73.39929962158203, 92.0845947265625, 505 -59.40851974487305, -84.4076919555664, 75.88834381103516, 506 96.02651977539062, -55.97655487060547, -1.7911018133163452 507 ], 508 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 509 } 510 }, 511 'operators': [{ 512 'name': 'reduceMin', 513 'arguments': [ 514 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} 515 ], 516 'outputs': 'reduceMinOutput' 517 }], 518 'expectedOutputs': { 519 'reduceMinOutput': { 520 'data': [-87.9623031616211], 521 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 522 } 523 } 524 } 525 }, 526 { 527 'name': 528 'reduceMin float32 4D tensor options.axes with options.keepDimensions=false', 529 'graph': { 530 'inputs': { 531 'reduceMinInput': { 532 'data': [ 533 -58.76195526123047, -87.9623031616211, -70.13690185546875, 534 -53.61766815185547, -39.50931167602539, 76.48815155029297, 535 -18.705087661743164, 44.78261947631836, 30.70233917236328, 536 61.46361541748047, 77.84043884277344, -53.747413635253906, 537 -31.713542938232422, -9.735438346862793, 77.9365234375, 538 99.01705932617188, 73.39929962158203, 92.0845947265625, 539 -59.40851974487305, -84.4076919555664, 75.88834381103516, 540 96.02651977539062, -55.97655487060547, -1.7911018133163452 541 ], 542 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 543 } 544 }, 545 'operators': [{ 546 'name': 'reduceMin', 547 'arguments': [ 548 {'input': 'reduceMinInput'}, 549 {'options': {'axes': [1, 3], 'keepDimensions': false}} 550 ], 551 'outputs': 'reduceMinOutput' 552 }], 553 'expectedOutputs': { 554 'reduceMinOutput': { 555 'data': [ 556 -87.9623031616211, -53.747413635253906, -84.4076919555664, 557 -55.97655487060547 558 ], 559 'descriptor': {shape: [2, 2], dataType: 'float32'} 560 } 561 } 562 } 563 }, 564 { 565 'name': 566 'reduceMin float32 4D tensor options.axes with options.keepDimensions=true', 567 'graph': { 568 'inputs': { 569 'reduceMinInput': { 570 'data': [ 571 -58.76195526123047, -87.9623031616211, -70.13690185546875, 572 -53.61766815185547, -39.50931167602539, 76.48815155029297, 573 -18.705087661743164, 44.78261947631836, 30.70233917236328, 574 61.46361541748047, 77.84043884277344, -53.747413635253906, 575 -31.713542938232422, -9.735438346862793, 77.9365234375, 576 99.01705932617188, 73.39929962158203, 92.0845947265625, 577 -59.40851974487305, -84.4076919555664, 75.88834381103516, 578 96.02651977539062, -55.97655487060547, -1.7911018133163452 579 ], 580 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 581 } 582 }, 583 'operators': [{ 584 'name': 'reduceMin', 585 'arguments': [ 586 {'input': 'reduceMinInput'}, 587 {'options': {'axes': [1, 3], 'keepDimensions': true}} 588 ], 589 'outputs': 'reduceMinOutput' 590 }], 591 'expectedOutputs': { 592 'reduceMinOutput': { 593 'data': [ 594 -87.9623031616211, -53.747413635253906, -84.4076919555664, 595 -55.97655487060547 596 ], 597 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float32'} 598 } 599 } 600 } 601 }, 602 603 // float16 tests 604 { 605 'name': 'reduceMin float16 0D constant tensor default options', 606 'graph': { 607 'inputs': { 608 'reduceMinInput': { 609 'data': [-58.75], 610 'descriptor': {shape: [], dataType: 'float16'}, 611 'constant': true 612 } 613 }, 614 'operators': [{ 615 'name': 'reduceMin', 616 'arguments': [{'input': 'reduceMinInput'}], 617 'outputs': 'reduceMinOutput' 618 }], 619 'expectedOutputs': { 620 'reduceMinOutput': 621 {'data': [-58.75], 'descriptor': {shape: [], dataType: 'float16'}} 622 } 623 } 624 }, 625 { 626 'name': 'reduceMin float16 0D tensor default options', 627 'graph': { 628 'inputs': { 629 'reduceMinInput': { 630 'data': [-58.75], 631 'descriptor': {shape: [], dataType: 'float16'}, 632 'constant': false 633 } 634 }, 635 'operators': [{ 636 'name': 'reduceMin', 637 'arguments': [{'input': 'reduceMinInput'}], 638 'outputs': 'reduceMinOutput' 639 }], 640 'expectedOutputs': { 641 'reduceMinOutput': 642 {'data': [-58.75], 'descriptor': {shape: [], dataType: 'float16'}} 643 } 644 } 645 }, 646 { 647 'name': 'reduceMin float16 0D constant tensor empty axes', 648 'graph': { 649 'inputs': { 650 'reduceMinInput': { 651 'data': [-58.75], 652 'descriptor': {shape: [], dataType: 'float16'}, 653 'constant': true 654 } 655 }, 656 'operators': [{ 657 'name': 'reduceMin', 658 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], 659 'outputs': 'reduceMinOutput' 660 }], 661 'expectedOutputs': { 662 'reduceMinOutput': 663 {'data': [-58.75], 'descriptor': {shape: [], dataType: 'float16'}} 664 } 665 } 666 }, 667 { 668 'name': 'reduceMin float16 0D tensor empty axes', 669 'graph': { 670 'inputs': { 671 'reduceMinInput': { 672 'data': [-58.75], 673 'descriptor': {shape: [], dataType: 'float16'}, 674 'constant': false 675 } 676 }, 677 'operators': [{ 678 'name': 'reduceMin', 679 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], 680 'outputs': 'reduceMinOutput' 681 }], 682 'expectedOutputs': { 683 'reduceMinOutput': 684 {'data': [-58.75], 'descriptor': {shape: [], dataType: 'float16'}} 685 } 686 } 687 }, 688 { 689 'name': 'reduceMin float16 1D constant tensor default options', 690 'graph': { 691 'inputs': { 692 'reduceMinInput': { 693 'data': [ 694 -58.75, -87.9375, -70.125, -53.625, -39.5, 695 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 696 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 697 99, 73.375, 92.0625, -59.40625, -84.4375, 698 75.875, 96, -55.96875, -1.791015625 699 ], 700 'descriptor': {shape: [24], dataType: 'float16'}, 701 'constant': true 702 } 703 }, 704 'operators': [{ 705 'name': 'reduceMin', 706 'arguments': [{'input': 'reduceMinInput'}], 707 'outputs': 'reduceMinOutput' 708 }], 709 'expectedOutputs': { 710 'reduceMinOutput': 711 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 712 } 713 } 714 }, 715 { 716 'name': 'reduceMin float16 1D tensor default options', 717 'graph': { 718 'inputs': { 719 'reduceMinInput': { 720 'data': [ 721 -58.75, -87.9375, -70.125, -53.625, -39.5, 722 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 723 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 724 99, 73.375, 92.0625, -59.40625, -84.4375, 725 75.875, 96, -55.96875, -1.791015625 726 ], 727 'descriptor': {shape: [24], dataType: 'float16'} 728 } 729 }, 730 'operators': [{ 731 'name': 'reduceMin', 732 'arguments': [{'input': 'reduceMinInput'}], 733 'outputs': 'reduceMinOutput' 734 }], 735 'expectedOutputs': { 736 'reduceMinOutput': 737 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 738 } 739 } 740 }, 741 { 742 'name': 'reduceMin float16 2D tensor default options', 743 'graph': { 744 'inputs': { 745 'reduceMinInput': { 746 'data': [ 747 -58.75, -87.9375, -70.125, -53.625, -39.5, 748 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 749 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 750 99, 73.375, 92.0625, -59.40625, -84.4375, 751 75.875, 96, -55.96875, -1.791015625 752 ], 753 'descriptor': {shape: [4, 6], dataType: 'float16'} 754 } 755 }, 756 'operators': [{ 757 'name': 'reduceMin', 758 'arguments': [{'input': 'reduceMinInput'}], 759 'outputs': 'reduceMinOutput' 760 }], 761 'expectedOutputs': { 762 'reduceMinOutput': 763 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 764 } 765 } 766 }, 767 { 768 'name': 'reduceMin float16 3D tensor default options', 769 'graph': { 770 'inputs': { 771 'reduceMinInput': { 772 'data': [ 773 -58.75, -87.9375, -70.125, -53.625, -39.5, 774 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 775 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 776 99, 73.375, 92.0625, -59.40625, -84.4375, 777 75.875, 96, -55.96875, -1.791015625 778 ], 779 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 780 } 781 }, 782 'operators': [{ 783 'name': 'reduceMin', 784 'arguments': [{'input': 'reduceMinInput'}], 785 'outputs': 'reduceMinOutput' 786 }], 787 'expectedOutputs': { 788 'reduceMinOutput': 789 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 790 } 791 } 792 }, 793 { 794 'name': 'reduceMin float16 4D tensor default options', 795 'graph': { 796 'inputs': { 797 'reduceMinInput': { 798 'data': [ 799 -58.75, -87.9375, -70.125, -53.625, -39.5, 800 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 801 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 802 99, 73.375, 92.0625, -59.40625, -84.4375, 803 75.875, 96, -55.96875, -1.791015625 804 ], 805 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 806 } 807 }, 808 'operators': [{ 809 'name': 'reduceMin', 810 'arguments': [{'input': 'reduceMinInput'}], 811 'outputs': 'reduceMinOutput' 812 }], 813 'expectedOutputs': { 814 'reduceMinOutput': 815 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 816 } 817 } 818 }, 819 { 820 'name': 'reduceMin float16 5D tensor default options', 821 'graph': { 822 'inputs': { 823 'reduceMinInput': { 824 'data': [ 825 -58.75, -87.9375, -70.125, -53.625, -39.5, 826 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 827 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 828 99, 73.375, 92.0625, -59.40625, -84.4375, 829 75.875, 96, -55.96875, -1.791015625 830 ], 831 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} 832 } 833 }, 834 'operators': [{ 835 'name': 'reduceMin', 836 'arguments': [{'input': 'reduceMinInput'}], 837 'outputs': 'reduceMinOutput' 838 }], 839 'expectedOutputs': { 840 'reduceMinOutput': 841 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 842 } 843 } 844 }, 845 { 846 'name': 'reduceMin float16 3D tensor options.axes', 847 'graph': { 848 'inputs': { 849 'reduceMinInput': { 850 'data': [ 851 -58.75, -87.9375, -70.125, -53.625, -39.5, 852 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 853 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 854 99, 73.375, 92.0625, -59.40625, -84.4375, 855 75.875, 96, -55.96875, -1.791015625 856 ], 857 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 858 } 859 }, 860 'operators': [{ 861 'name': 'reduceMin', 862 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': [2]}}], 863 'outputs': 'reduceMinOutput' 864 }], 865 'expectedOutputs': { 866 'reduceMinOutput': { 867 'data': [-87.9375, -39.5, -53.75, -31.71875, -84.4375, -55.96875], 868 'descriptor': {shape: [2, 3], dataType: 'float16'} 869 } 870 } 871 } 872 }, 873 { 874 'name': 'reduceMin float16 4D tensor options.axes', 875 'graph': { 876 'inputs': { 877 'reduceMinInput': { 878 'data': [ 879 -58.75, -87.9375, -70.125, -53.625, -39.5, 880 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 881 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 882 99, 73.375, 92.0625, -59.40625, -84.4375, 883 75.875, 96, -55.96875, -1.791015625 884 ], 885 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 886 } 887 }, 888 'operators': [{ 889 'name': 'reduceMin', 890 'arguments': 891 [{'input': 'reduceMinInput'}, {'options': {'axes': [0, 2]}}], 892 'outputs': 'reduceMinOutput' 893 }], 894 'expectedOutputs': { 895 'reduceMinOutput': { 896 'data': [-58.75, -87.9375, -70.125, -59.40625, -84.4375, -53.75], 897 'descriptor': {shape: [2, 3], dataType: 'float16'} 898 } 899 } 900 } 901 }, 902 { 903 'name': 'reduceMin float16 3D tensor options.keepDimensions=false', 904 'graph': { 905 'inputs': { 906 'reduceMinInput': { 907 'data': [ 908 -58.75, -87.9375, -70.125, -53.625, -39.5, 909 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 910 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 911 99, 73.375, 92.0625, -59.40625, -84.4375, 912 75.875, 96, -55.96875, -1.791015625 913 ], 914 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 915 } 916 }, 917 'operators': [{ 918 'name': 'reduceMin', 919 'arguments': [ 920 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} 921 ], 922 'outputs': 'reduceMinOutput' 923 }], 924 'expectedOutputs': { 925 'reduceMinOutput': 926 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 927 } 928 } 929 }, 930 { 931 'name': 'reduceMin float16 3D tensor options.keepDimensions=true', 932 'graph': { 933 'inputs': { 934 'reduceMinInput': { 935 'data': [ 936 -58.75, -87.9375, -70.125, -53.625, -39.5, 937 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 938 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 939 99, 73.375, 92.0625, -59.40625, -84.4375, 940 75.875, 96, -55.96875, -1.791015625 941 ], 942 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 943 } 944 }, 945 'operators': [{ 946 'name': 'reduceMin', 947 'arguments': [ 948 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} 949 ], 950 'outputs': 'reduceMinOutput' 951 }], 952 'expectedOutputs': { 953 'reduceMinOutput': { 954 'data': [-87.9375], 955 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} 956 } 957 } 958 } 959 }, 960 { 961 'name': 'reduceMin float16 4D tensor options.keepDimensions=false', 962 'graph': { 963 'inputs': { 964 'reduceMinInput': { 965 'data': [ 966 -58.75, -87.9375, -70.125, -53.625, -39.5, 967 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 968 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 969 99, 73.375, 92.0625, -59.40625, -84.4375, 970 75.875, 96, -55.96875, -1.791015625 971 ], 972 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 973 } 974 }, 975 'operators': [{ 976 'name': 'reduceMin', 977 'arguments': [ 978 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} 979 ], 980 'outputs': 'reduceMinOutput' 981 }], 982 'expectedOutputs': { 983 'reduceMinOutput': 984 {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} 985 } 986 } 987 }, 988 { 989 'name': 'reduceMin float16 4D tensor options.keepDimensions=true', 990 'graph': { 991 'inputs': { 992 'reduceMinInput': { 993 'data': [ 994 -58.75, -87.9375, -70.125, -53.625, -39.5, 995 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 996 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 997 99, 73.375, 92.0625, -59.40625, -84.4375, 998 75.875, 96, -55.96875, -1.791015625 999 ], 1000 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1001 } 1002 }, 1003 'operators': [{ 1004 'name': 'reduceMin', 1005 'arguments': [ 1006 {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} 1007 ], 1008 'outputs': 'reduceMinOutput' 1009 }], 1010 'expectedOutputs': { 1011 'reduceMinOutput': { 1012 'data': [-87.9375], 1013 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} 1014 } 1015 } 1016 } 1017 }, 1018 { 1019 'name': 1020 'reduceMin float16 4D tensor options.axes with options.keepDimensions=false', 1021 'graph': { 1022 'inputs': { 1023 'reduceMinInput': { 1024 'data': [ 1025 -58.75, -87.9375, -70.125, -53.625, -39.5, 1026 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 1027 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 1028 99, 73.375, 92.0625, -59.40625, -84.4375, 1029 75.875, 96, -55.96875, -1.791015625 1030 ], 1031 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1032 } 1033 }, 1034 'operators': [{ 1035 'name': 'reduceMin', 1036 'arguments': [ 1037 {'input': 'reduceMinInput'}, 1038 {'options': {'axes': [1, 3], 'keepDimensions': false}} 1039 ], 1040 'outputs': 'reduceMinOutput' 1041 }], 1042 'expectedOutputs': { 1043 'reduceMinOutput': { 1044 'data': [-87.9375, -53.75, -84.4375, -55.96875], 1045 'descriptor': {shape: [2, 2], dataType: 'float16'} 1046 } 1047 } 1048 } 1049 }, 1050 { 1051 'name': 1052 'reduceMin float16 4D tensor options.axes with options.keepDimensions=true', 1053 'graph': { 1054 'inputs': { 1055 'reduceMinInput': { 1056 'data': [ 1057 -58.75, -87.9375, -70.125, -53.625, -39.5, 1058 76.5, -18.703125, 44.78125, 30.703125, 61.46875, 1059 77.8125, -53.75, -31.71875, -9.734375, 77.9375, 1060 99, 73.375, 92.0625, -59.40625, -84.4375, 1061 75.875, 96, -55.96875, -1.791015625 1062 ], 1063 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1064 } 1065 }, 1066 'operators': [{ 1067 'name': 'reduceMin', 1068 'arguments': [ 1069 {'input': 'reduceMinInput'}, 1070 {'options': {'axes': [1, 3], 'keepDimensions': true}} 1071 ], 1072 'outputs': 'reduceMinOutput' 1073 }], 1074 'expectedOutputs': { 1075 'reduceMinOutput': { 1076 'data': [-87.9375, -53.75, -84.4375, -55.96875], 1077 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} 1078 } 1079 } 1080 } 1081 } 1082 ]; 1083 1084 webnn_conformance_test( 1085 reduceMinTests, buildAndExecuteGraph, getPrecisionTolerance);