min.https.any.js (37883B)
1 // META: title=test WebNN API element-wise min operation 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/#api-mlgraphbuilder-binary 12 // Compute the element-wise binary minimum of the two input tensors. 13 // MLOperand min(MLOperand a, MLOperand b); 14 15 const minTests = [ 16 { 17 'name': 'min float32 1D constant tensors', 18 'graph': { 19 'inputs': { 20 'inputA': { 21 'data': [ 22 -36.06953048706055, -38.2254524230957, 62.07444381713867, 23 -16.610267639160156, 65.99324798583984, -17.77212905883789, 24 -76.01380920410156, -69.59134674072266, 53.60376739501953, 25 -39.096099853515625, 96.94400787353516, -40.39130401611328, 26 74.14437103271484, 0.03283197432756424, 38.79835510253906, 27 -17.720787048339844, 17.383201599121094, -82.3099365234375, 28 -80.47379302978516, -31.389848709106445, -73.2723617553711, 29 -33.74562072753906, -21.70152473449707, 4.945605278015137 30 ], 31 'descriptor': {shape: [24], dataType: 'float32'}, 32 'constant': true 33 }, 34 'inputB': { 35 'data': [ 36 -40.10139083862305, 86.25190734863281, 51.280174255371094, 37 -57.64906311035156, -97.56107330322266, -28.881731033325195, 38 80.49571228027344, 46.6654052734375, 62.80685806274414, 39 49.81534194946289, -76.52043151855469, 84.5990982055664, 40 50.47281265258789, -18.01728630065918, 5.198459148406982, 41 -47.82608413696289, 46.450077056884766, -71.25122833251953, 42 -69.85066223144531, 40.676490783691406, -18.700122833251953, 43 20.14988136291504, 41.95068359375, 23.482912063598633 44 ], 45 'descriptor': {shape: [24], dataType: 'float32'}, 46 'constant': true 47 } 48 }, 49 'operators': [{ 50 'name': 'min', 51 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 52 'outputs': 'output' 53 }], 54 'expectedOutputs': { 55 'output': { 56 'data': [ 57 -40.10139083862305, -38.2254524230957, 51.280174255371094, 58 -57.64906311035156, -97.56107330322266, -28.881731033325195, 59 -76.01380920410156, -69.59134674072266, 53.60376739501953, 60 -39.096099853515625, -76.52043151855469, -40.39130401611328, 61 50.47281265258789, -18.01728630065918, 5.198459148406982, 62 -47.82608413696289, 17.383201599121094, -82.3099365234375, 63 -80.47379302978516, -31.389848709106445, -73.2723617553711, 64 -33.74562072753906, -21.70152473449707, 4.945605278015137 65 ], 66 'descriptor': {shape: [24], dataType: 'float32'} 67 } 68 } 69 } 70 }, 71 { 72 'name': 'min float32 1D tensors', 73 'graph': { 74 'inputs': { 75 'inputA': { 76 'data': [ 77 -36.06953048706055, -38.2254524230957, 62.07444381713867, 78 -16.610267639160156, 65.99324798583984, -17.77212905883789, 79 -76.01380920410156, -69.59134674072266, 53.60376739501953, 80 -39.096099853515625, 96.94400787353516, -40.39130401611328, 81 74.14437103271484, 0.03283197432756424, 38.79835510253906, 82 -17.720787048339844, 17.383201599121094, -82.3099365234375, 83 -80.47379302978516, -31.389848709106445, -73.2723617553711, 84 -33.74562072753906, -21.70152473449707, 4.945605278015137 85 ], 86 'descriptor': {shape: [24], dataType: 'float32'} 87 }, 88 'inputB': { 89 'data': [ 90 -40.10139083862305, 86.25190734863281, 51.280174255371094, 91 -57.64906311035156, -97.56107330322266, -28.881731033325195, 92 80.49571228027344, 46.6654052734375, 62.80685806274414, 93 49.81534194946289, -76.52043151855469, 84.5990982055664, 94 50.47281265258789, -18.01728630065918, 5.198459148406982, 95 -47.82608413696289, 46.450077056884766, -71.25122833251953, 96 -69.85066223144531, 40.676490783691406, -18.700122833251953, 97 20.14988136291504, 41.95068359375, 23.482912063598633 98 ], 99 'descriptor': {shape: [24], dataType: 'float32'} 100 } 101 }, 102 'operators': [{ 103 'name': 'min', 104 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 105 'outputs': 'output' 106 }], 107 'expectedOutputs': { 108 'output': { 109 'data': [ 110 -40.10139083862305, -38.2254524230957, 51.280174255371094, 111 -57.64906311035156, -97.56107330322266, -28.881731033325195, 112 -76.01380920410156, -69.59134674072266, 53.60376739501953, 113 -39.096099853515625, -76.52043151855469, -40.39130401611328, 114 50.47281265258789, -18.01728630065918, 5.198459148406982, 115 -47.82608413696289, 17.383201599121094, -82.3099365234375, 116 -80.47379302978516, -31.389848709106445, -73.2723617553711, 117 -33.74562072753906, -21.70152473449707, 4.945605278015137 118 ], 119 'descriptor': {shape: [24], dataType: 'float32'} 120 } 121 } 122 } 123 }, 124 { 125 'name': 'min float32 2D tensors', 126 'graph': { 127 'inputs': { 128 'inputA': { 129 'data': [ 130 -36.06953048706055, -38.2254524230957, 62.07444381713867, 131 -16.610267639160156, 65.99324798583984, -17.77212905883789, 132 -76.01380920410156, -69.59134674072266, 53.60376739501953, 133 -39.096099853515625, 96.94400787353516, -40.39130401611328, 134 74.14437103271484, 0.03283197432756424, 38.79835510253906, 135 -17.720787048339844, 17.383201599121094, -82.3099365234375, 136 -80.47379302978516, -31.389848709106445, -73.2723617553711, 137 -33.74562072753906, -21.70152473449707, 4.945605278015137 138 ], 139 'descriptor': {shape: [4, 6], dataType: 'float32'} 140 }, 141 'inputB': { 142 'data': [ 143 -40.10139083862305, 86.25190734863281, 51.280174255371094, 144 -57.64906311035156, -97.56107330322266, -28.881731033325195, 145 80.49571228027344, 46.6654052734375, 62.80685806274414, 146 49.81534194946289, -76.52043151855469, 84.5990982055664, 147 50.47281265258789, -18.01728630065918, 5.198459148406982, 148 -47.82608413696289, 46.450077056884766, -71.25122833251953, 149 -69.85066223144531, 40.676490783691406, -18.700122833251953, 150 20.14988136291504, 41.95068359375, 23.482912063598633 151 ], 152 'descriptor': {shape: [4, 6], dataType: 'float32'} 153 } 154 }, 155 'operators': [{ 156 'name': 'min', 157 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 158 'outputs': 'output' 159 }], 160 'expectedOutputs': { 161 'output': { 162 'data': [ 163 -40.10139083862305, -38.2254524230957, 51.280174255371094, 164 -57.64906311035156, -97.56107330322266, -28.881731033325195, 165 -76.01380920410156, -69.59134674072266, 53.60376739501953, 166 -39.096099853515625, -76.52043151855469, -40.39130401611328, 167 50.47281265258789, -18.01728630065918, 5.198459148406982, 168 -47.82608413696289, 17.383201599121094, -82.3099365234375, 169 -80.47379302978516, -31.389848709106445, -73.2723617553711, 170 -33.74562072753906, -21.70152473449707, 4.945605278015137 171 ], 172 'descriptor': {shape: [4, 6], dataType: 'float32'} 173 } 174 } 175 } 176 }, 177 { 178 'name': 'min float32 3D tensors', 179 'graph': { 180 'inputs': { 181 'inputA': { 182 'data': [ 183 -36.06953048706055, -38.2254524230957, 62.07444381713867, 184 -16.610267639160156, 65.99324798583984, -17.77212905883789, 185 -76.01380920410156, -69.59134674072266, 53.60376739501953, 186 -39.096099853515625, 96.94400787353516, -40.39130401611328, 187 74.14437103271484, 0.03283197432756424, 38.79835510253906, 188 -17.720787048339844, 17.383201599121094, -82.3099365234375, 189 -80.47379302978516, -31.389848709106445, -73.2723617553711, 190 -33.74562072753906, -21.70152473449707, 4.945605278015137 191 ], 192 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 193 }, 194 'inputB': { 195 'data': [ 196 -40.10139083862305, 86.25190734863281, 51.280174255371094, 197 -57.64906311035156, -97.56107330322266, -28.881731033325195, 198 80.49571228027344, 46.6654052734375, 62.80685806274414, 199 49.81534194946289, -76.52043151855469, 84.5990982055664, 200 50.47281265258789, -18.01728630065918, 5.198459148406982, 201 -47.82608413696289, 46.450077056884766, -71.25122833251953, 202 -69.85066223144531, 40.676490783691406, -18.700122833251953, 203 20.14988136291504, 41.95068359375, 23.482912063598633 204 ], 205 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 206 } 207 }, 208 'operators': [{ 209 'name': 'min', 210 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 211 'outputs': 'output' 212 }], 213 'expectedOutputs': { 214 'output': { 215 'data': [ 216 -40.10139083862305, -38.2254524230957, 51.280174255371094, 217 -57.64906311035156, -97.56107330322266, -28.881731033325195, 218 -76.01380920410156, -69.59134674072266, 53.60376739501953, 219 -39.096099853515625, -76.52043151855469, -40.39130401611328, 220 50.47281265258789, -18.01728630065918, 5.198459148406982, 221 -47.82608413696289, 17.383201599121094, -82.3099365234375, 222 -80.47379302978516, -31.389848709106445, -73.2723617553711, 223 -33.74562072753906, -21.70152473449707, 4.945605278015137 224 ], 225 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 226 } 227 } 228 } 229 }, 230 { 231 'name': 'min float32 4D tensors', 232 'graph': { 233 'inputs': { 234 'inputA': { 235 'data': [ 236 -36.06953048706055, -38.2254524230957, 62.07444381713867, 237 -16.610267639160156, 65.99324798583984, -17.77212905883789, 238 -76.01380920410156, -69.59134674072266, 53.60376739501953, 239 -39.096099853515625, 96.94400787353516, -40.39130401611328, 240 74.14437103271484, 0.03283197432756424, 38.79835510253906, 241 -17.720787048339844, 17.383201599121094, -82.3099365234375, 242 -80.47379302978516, -31.389848709106445, -73.2723617553711, 243 -33.74562072753906, -21.70152473449707, 4.945605278015137 244 ], 245 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 246 }, 247 'inputB': { 248 'data': [ 249 -40.10139083862305, 86.25190734863281, 51.280174255371094, 250 -57.64906311035156, -97.56107330322266, -28.881731033325195, 251 80.49571228027344, 46.6654052734375, 62.80685806274414, 252 49.81534194946289, -76.52043151855469, 84.5990982055664, 253 50.47281265258789, -18.01728630065918, 5.198459148406982, 254 -47.82608413696289, 46.450077056884766, -71.25122833251953, 255 -69.85066223144531, 40.676490783691406, -18.700122833251953, 256 20.14988136291504, 41.95068359375, 23.482912063598633 257 ], 258 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 259 } 260 }, 261 'operators': [{ 262 'name': 'min', 263 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 264 'outputs': 'output' 265 }], 266 'expectedOutputs': { 267 'output': { 268 'data': [ 269 -40.10139083862305, -38.2254524230957, 51.280174255371094, 270 -57.64906311035156, -97.56107330322266, -28.881731033325195, 271 -76.01380920410156, -69.59134674072266, 53.60376739501953, 272 -39.096099853515625, -76.52043151855469, -40.39130401611328, 273 50.47281265258789, -18.01728630065918, 5.198459148406982, 274 -47.82608413696289, 17.383201599121094, -82.3099365234375, 275 -80.47379302978516, -31.389848709106445, -73.2723617553711, 276 -33.74562072753906, -21.70152473449707, 4.945605278015137 277 ], 278 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 279 } 280 } 281 } 282 }, 283 { 284 'name': 'min float32 5D tensors', 285 'graph': { 286 'inputs': { 287 'inputA': { 288 'data': [ 289 -36.06953048706055, -38.2254524230957, 62.07444381713867, 290 -16.610267639160156, 65.99324798583984, -17.77212905883789, 291 -76.01380920410156, -69.59134674072266, 53.60376739501953, 292 -39.096099853515625, 96.94400787353516, -40.39130401611328, 293 74.14437103271484, 0.03283197432756424, 38.79835510253906, 294 -17.720787048339844, 17.383201599121094, -82.3099365234375, 295 -80.47379302978516, -31.389848709106445, -73.2723617553711, 296 -33.74562072753906, -21.70152473449707, 4.945605278015137 297 ], 298 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 299 }, 300 'inputB': { 301 'data': [ 302 -40.10139083862305, 86.25190734863281, 51.280174255371094, 303 -57.64906311035156, -97.56107330322266, -28.881731033325195, 304 80.49571228027344, 46.6654052734375, 62.80685806274414, 305 49.81534194946289, -76.52043151855469, 84.5990982055664, 306 50.47281265258789, -18.01728630065918, 5.198459148406982, 307 -47.82608413696289, 46.450077056884766, -71.25122833251953, 308 -69.85066223144531, 40.676490783691406, -18.700122833251953, 309 20.14988136291504, 41.95068359375, 23.482912063598633 310 ], 311 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 312 } 313 }, 314 'operators': [{ 315 'name': 'min', 316 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 317 'outputs': 'output' 318 }], 319 'expectedOutputs': { 320 'output': { 321 'data': [ 322 -40.10139083862305, -38.2254524230957, 51.280174255371094, 323 -57.64906311035156, -97.56107330322266, -28.881731033325195, 324 -76.01380920410156, -69.59134674072266, 53.60376739501953, 325 -39.096099853515625, -76.52043151855469, -40.39130401611328, 326 50.47281265258789, -18.01728630065918, 5.198459148406982, 327 -47.82608413696289, 17.383201599121094, -82.3099365234375, 328 -80.47379302978516, -31.389848709106445, -73.2723617553711, 329 -33.74562072753906, -21.70152473449707, 4.945605278015137 330 ], 331 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 332 } 333 } 334 } 335 }, 336 { 337 'name': 'min float32 broadcast 1D to 4D', 338 'graph': { 339 'inputs': { 340 'inputA': { 341 'data': [34.42634582519531], 342 'descriptor': {shape: [1], dataType: 'float32'} 343 }, 344 'inputB': { 345 'data': [ 346 -36.06953048706055, -38.2254524230957, 62.07444381713867, 347 -16.610267639160156, 65.99324798583984, -17.77212905883789, 348 -76.01380920410156, -69.59134674072266, 53.60376739501953, 349 -39.096099853515625, 96.94400787353516, -40.39130401611328, 350 74.14437103271484, 0.03283197432756424, 38.79835510253906, 351 -17.720787048339844, 17.383201599121094, -82.3099365234375, 352 -80.47379302978516, -31.389848709106445, -73.2723617553711, 353 -33.74562072753906, -21.70152473449707, 4.945605278015137 354 ], 355 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 356 } 357 }, 358 'operators': [{ 359 'name': 'min', 360 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 361 'outputs': 'output' 362 }], 363 'expectedOutputs': { 364 'output': { 365 'data': [ 366 -36.06953048706055, -38.2254524230957, 34.42634582519531, 367 -16.610267639160156, 34.42634582519531, -17.77212905883789, 368 -76.01380920410156, -69.59134674072266, 34.42634582519531, 369 -39.096099853515625, 34.42634582519531, -40.39130401611328, 370 34.42634582519531, 0.03283197432756424, 34.42634582519531, 371 -17.720787048339844, 17.383201599121094, -82.3099365234375, 372 -80.47379302978516, -31.389848709106445, -73.2723617553711, 373 -33.74562072753906, -21.70152473449707, 4.945605278015137 374 ], 375 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 376 } 377 } 378 } 379 }, 380 { 381 'name': 'min float32 broadcast 2D to 4D', 382 'graph': { 383 'inputs': { 384 'inputA': { 385 'data': [ 386 -36.06953048706055, -38.2254524230957, 62.07444381713867, 387 -16.610267639160156, 65.99324798583984, -17.77212905883789, 388 -76.01380920410156, -69.59134674072266, 53.60376739501953, 389 -39.096099853515625, 96.94400787353516, -40.39130401611328, 390 74.14437103271484, 0.03283197432756424, 38.79835510253906, 391 -17.720787048339844, 17.383201599121094, -82.3099365234375, 392 -80.47379302978516, -31.389848709106445, -73.2723617553711, 393 -33.74562072753906, -21.70152473449707, 4.945605278015137 394 ], 395 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 396 }, 397 'inputB': { 398 'data': [ 399 -19.072668075561523, -78.27516174316406, -13.436244010925293, 400 -93.01346588134766, -72.27899169921875, 63.14110565185547 401 ], 402 'descriptor': {shape: [2, 3], dataType: 'float32'} 403 } 404 }, 405 'operators': [{ 406 'name': 'min', 407 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 408 'outputs': 'output' 409 }], 410 'expectedOutputs': { 411 'output': { 412 'data': [ 413 -36.06953048706055, -78.27516174316406, -13.436244010925293, 414 -93.01346588134766, -72.27899169921875, -17.77212905883789, 415 -76.01380920410156, -78.27516174316406, -13.436244010925293, 416 -93.01346588134766, -72.27899169921875, -40.39130401611328, 417 -19.072668075561523, -78.27516174316406, -13.436244010925293, 418 -93.01346588134766, -72.27899169921875, -82.3099365234375, 419 -80.47379302978516, -78.27516174316406, -73.2723617553711, 420 -93.01346588134766, -72.27899169921875, 4.945605278015137 421 ], 422 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 423 } 424 } 425 } 426 }, 427 { 428 'name': 'min float32 broadcast 3D to 4D', 429 'graph': { 430 'inputs': { 431 'inputA': { 432 'data': [ 433 -36.06953048706055, -38.2254524230957, 62.07444381713867, 434 -16.610267639160156, 65.99324798583984, -17.77212905883789, 435 -76.01380920410156, -69.59134674072266, 53.60376739501953, 436 -39.096099853515625, 96.94400787353516, -40.39130401611328, 437 74.14437103271484, 0.03283197432756424, 38.79835510253906, 438 -17.720787048339844, 17.383201599121094, -82.3099365234375, 439 -80.47379302978516, -31.389848709106445, -73.2723617553711, 440 -33.74562072753906, -21.70152473449707, 4.945605278015137 441 ], 442 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 443 }, 444 'inputB': { 445 'data': [ 446 23.231731414794922, 84.62673950195312, -83.33529663085938, 447 -22.82455825805664 448 ], 449 'descriptor': {shape: [2, 2, 1], dataType: 'float32'} 450 } 451 }, 452 'operators': [{ 453 'name': 'min', 454 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 455 'outputs': 'output' 456 }], 457 'expectedOutputs': { 458 'output': { 459 'data': [ 460 -36.06953048706055, -38.2254524230957, 23.231731414794922, 461 -16.610267639160156, 65.99324798583984, -17.77212905883789, 462 -83.33529663085938, -83.33529663085938, -83.33529663085938, 463 -39.096099853515625, -22.82455825805664, -40.39130401611328, 464 23.231731414794922, 0.03283197432756424, 23.231731414794922, 465 -17.720787048339844, 17.383201599121094, -82.3099365234375, 466 -83.33529663085938, -83.33529663085938, -83.33529663085938, 467 -33.74562072753906, -22.82455825805664, -22.82455825805664 468 ], 469 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 470 } 471 } 472 } 473 }, 474 { 475 'name': 'min float32 broadcast 4D to 4D', 476 'graph': { 477 'inputs': { 478 'inputA': { 479 'data': [34.42634582519531], 480 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 481 }, 482 'inputB': { 483 'data': [ 484 -36.06953048706055, -38.2254524230957, 62.07444381713867, 485 -16.610267639160156, 65.99324798583984, -17.77212905883789, 486 -76.01380920410156, -69.59134674072266, 53.60376739501953, 487 -39.096099853515625, 96.94400787353516, -40.39130401611328, 488 74.14437103271484, 0.03283197432756424, 38.79835510253906, 489 -17.720787048339844, 17.383201599121094, -82.3099365234375, 490 -80.47379302978516, -31.389848709106445, -73.2723617553711, 491 -33.74562072753906, -21.70152473449707, 4.945605278015137 492 ], 493 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 494 } 495 }, 496 'operators': [{ 497 'name': 'min', 498 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 499 'outputs': 'output' 500 }], 501 'expectedOutputs': { 502 'output': { 503 'data': [ 504 -36.06953048706055, -38.2254524230957, 34.42634582519531, 505 -16.610267639160156, 34.42634582519531, -17.77212905883789, 506 -76.01380920410156, -69.59134674072266, 34.42634582519531, 507 -39.096099853515625, 34.42634582519531, -40.39130401611328, 508 34.42634582519531, 0.03283197432756424, 34.42634582519531, 509 -17.720787048339844, 17.383201599121094, -82.3099365234375, 510 -80.47379302978516, -31.389848709106445, -73.2723617553711, 511 -33.74562072753906, -21.70152473449707, 4.945605278015137 512 ], 513 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 514 } 515 } 516 } 517 }, 518 519 // float16 tests 520 { 521 'name': 'min float16 1D constant tensors', 522 'graph': { 523 'inputs': { 524 'inputA': { 525 'data': [ 526 -36.0625, -38.21875, 62.0625, -16.609375, 66, 527 -17.765625, -76, -69.5625, 53.59375, -39.09375, 528 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 529 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 530 -73.25, -33.75, -21.703125, 4.9453125 531 ], 532 'descriptor': {shape: [24], dataType: 'float16'}, 533 'constant': true 534 }, 535 'inputB': { 536 'data': [ 537 -40.09375, 86.25, 51.28125, -57.65625, -97.5625, -28.875, 538 80.5, 46.65625, 62.8125, 49.8125, -76.5, 84.625, 539 50.46875, -18.015625, 5.19921875, -47.8125, 46.4375, -71.25, 540 -69.875, 40.6875, -18.703125, 20.15625, 41.9375, 23.484375 541 ], 542 'descriptor': {shape: [24], dataType: 'float16'}, 543 'constant': true 544 } 545 }, 546 'operators': [{ 547 'name': 'min', 548 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 549 'outputs': 'output' 550 }], 551 'expectedOutputs': { 552 'output': { 553 'data': [ 554 -40.09375, -38.21875, 51.28125, -57.65625, -97.5625, 555 -28.875, -76, -69.5625, 53.59375, -39.09375, 556 -76.5, -40.40625, 50.46875, -18.015625, 5.19921875, 557 -47.8125, 17.390625, -82.3125, -80.5, -31.390625, 558 -73.25, -33.75, -21.703125, 4.9453125 559 ], 560 'descriptor': {shape: [24], dataType: 'float16'} 561 } 562 } 563 } 564 }, 565 { 566 'name': 'min float16 1D tensors', 567 'graph': { 568 'inputs': { 569 'inputA': { 570 'data': [ 571 -36.0625, -38.21875, 62.0625, -16.609375, 66, 572 -17.765625, -76, -69.5625, 53.59375, -39.09375, 573 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 574 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 575 -73.25, -33.75, -21.703125, 4.9453125 576 ], 577 'descriptor': {shape: [24], dataType: 'float16'} 578 }, 579 'inputB': { 580 'data': [ 581 -40.09375, 86.25, 51.28125, -57.65625, -97.5625, -28.875, 582 80.5, 46.65625, 62.8125, 49.8125, -76.5, 84.625, 583 50.46875, -18.015625, 5.19921875, -47.8125, 46.4375, -71.25, 584 -69.875, 40.6875, -18.703125, 20.15625, 41.9375, 23.484375 585 ], 586 'descriptor': {shape: [24], dataType: 'float16'} 587 } 588 }, 589 'operators': [{ 590 'name': 'min', 591 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 592 'outputs': 'output' 593 }], 594 'expectedOutputs': { 595 'output': { 596 'data': [ 597 -40.09375, -38.21875, 51.28125, -57.65625, -97.5625, 598 -28.875, -76, -69.5625, 53.59375, -39.09375, 599 -76.5, -40.40625, 50.46875, -18.015625, 5.19921875, 600 -47.8125, 17.390625, -82.3125, -80.5, -31.390625, 601 -73.25, -33.75, -21.703125, 4.9453125 602 ], 603 'descriptor': {shape: [24], dataType: 'float16'} 604 } 605 } 606 } 607 }, 608 { 609 'name': 'min float16 2D tensors', 610 'graph': { 611 'inputs': { 612 'inputA': { 613 'data': [ 614 -36.0625, -38.21875, 62.0625, -16.609375, 66, 615 -17.765625, -76, -69.5625, 53.59375, -39.09375, 616 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 617 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 618 -73.25, -33.75, -21.703125, 4.9453125 619 ], 620 'descriptor': {shape: [4, 6], dataType: 'float16'} 621 }, 622 'inputB': { 623 'data': [ 624 -40.09375, 86.25, 51.28125, -57.65625, -97.5625, -28.875, 625 80.5, 46.65625, 62.8125, 49.8125, -76.5, 84.625, 626 50.46875, -18.015625, 5.19921875, -47.8125, 46.4375, -71.25, 627 -69.875, 40.6875, -18.703125, 20.15625, 41.9375, 23.484375 628 ], 629 'descriptor': {shape: [4, 6], dataType: 'float16'} 630 } 631 }, 632 'operators': [{ 633 'name': 'min', 634 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 635 'outputs': 'output' 636 }], 637 'expectedOutputs': { 638 'output': { 639 'data': [ 640 -40.09375, -38.21875, 51.28125, -57.65625, -97.5625, 641 -28.875, -76, -69.5625, 53.59375, -39.09375, 642 -76.5, -40.40625, 50.46875, -18.015625, 5.19921875, 643 -47.8125, 17.390625, -82.3125, -80.5, -31.390625, 644 -73.25, -33.75, -21.703125, 4.9453125 645 ], 646 'descriptor': {shape: [4, 6], dataType: 'float16'} 647 } 648 } 649 } 650 }, 651 { 652 'name': 'min float16 3D tensors', 653 'graph': { 654 'inputs': { 655 'inputA': { 656 'data': [ 657 -36.0625, -38.21875, 62.0625, -16.609375, 66, 658 -17.765625, -76, -69.5625, 53.59375, -39.09375, 659 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 660 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 661 -73.25, -33.75, -21.703125, 4.9453125 662 ], 663 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 664 }, 665 'inputB': { 666 'data': [ 667 -40.09375, 86.25, 51.28125, -57.65625, -97.5625, -28.875, 668 80.5, 46.65625, 62.8125, 49.8125, -76.5, 84.625, 669 50.46875, -18.015625, 5.19921875, -47.8125, 46.4375, -71.25, 670 -69.875, 40.6875, -18.703125, 20.15625, 41.9375, 23.484375 671 ], 672 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 673 } 674 }, 675 'operators': [{ 676 'name': 'min', 677 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 678 'outputs': 'output' 679 }], 680 'expectedOutputs': { 681 'output': { 682 'data': [ 683 -40.09375, -38.21875, 51.28125, -57.65625, -97.5625, 684 -28.875, -76, -69.5625, 53.59375, -39.09375, 685 -76.5, -40.40625, 50.46875, -18.015625, 5.19921875, 686 -47.8125, 17.390625, -82.3125, -80.5, -31.390625, 687 -73.25, -33.75, -21.703125, 4.9453125 688 ], 689 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 690 } 691 } 692 } 693 }, 694 { 695 'name': 'min float16 4D tensors', 696 'graph': { 697 'inputs': { 698 'inputA': { 699 'data': [ 700 -36.0625, -38.21875, 62.0625, -16.609375, 66, 701 -17.765625, -76, -69.5625, 53.59375, -39.09375, 702 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 703 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 704 -73.25, -33.75, -21.703125, 4.9453125 705 ], 706 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 707 }, 708 'inputB': { 709 'data': [ 710 -40.09375, 86.25, 51.28125, -57.65625, -97.5625, -28.875, 711 80.5, 46.65625, 62.8125, 49.8125, -76.5, 84.625, 712 50.46875, -18.015625, 5.19921875, -47.8125, 46.4375, -71.25, 713 -69.875, 40.6875, -18.703125, 20.15625, 41.9375, 23.484375 714 ], 715 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 716 } 717 }, 718 'operators': [{ 719 'name': 'min', 720 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 721 'outputs': 'output' 722 }], 723 'expectedOutputs': { 724 'output': { 725 'data': [ 726 -40.09375, -38.21875, 51.28125, -57.65625, -97.5625, 727 -28.875, -76, -69.5625, 53.59375, -39.09375, 728 -76.5, -40.40625, 50.46875, -18.015625, 5.19921875, 729 -47.8125, 17.390625, -82.3125, -80.5, -31.390625, 730 -73.25, -33.75, -21.703125, 4.9453125 731 ], 732 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 733 } 734 } 735 } 736 }, 737 { 738 'name': 'min float16 5D tensors', 739 'graph': { 740 'inputs': { 741 'inputA': { 742 'data': [ 743 -36.0625, -38.21875, 62.0625, -16.609375, 66, 744 -17.765625, -76, -69.5625, 53.59375, -39.09375, 745 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 746 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 747 -73.25, -33.75, -21.703125, 4.9453125 748 ], 749 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 750 }, 751 'inputB': { 752 'data': [ 753 -40.09375, 86.25, 51.28125, -57.65625, -97.5625, -28.875, 754 80.5, 46.65625, 62.8125, 49.8125, -76.5, 84.625, 755 50.46875, -18.015625, 5.19921875, -47.8125, 46.4375, -71.25, 756 -69.875, 40.6875, -18.703125, 20.15625, 41.9375, 23.484375 757 ], 758 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 759 } 760 }, 761 'operators': [{ 762 'name': 'min', 763 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 764 'outputs': 'output' 765 }], 766 'expectedOutputs': { 767 'output': { 768 'data': [ 769 -40.09375, -38.21875, 51.28125, -57.65625, -97.5625, 770 -28.875, -76, -69.5625, 53.59375, -39.09375, 771 -76.5, -40.40625, 50.46875, -18.015625, 5.19921875, 772 -47.8125, 17.390625, -82.3125, -80.5, -31.390625, 773 -73.25, -33.75, -21.703125, 4.9453125 774 ], 775 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 776 } 777 } 778 } 779 }, 780 { 781 'name': 'min float16 broadcast 1D to 4D', 782 'graph': { 783 'inputs': { 784 'inputA': { 785 'data': [34.4375], 786 'descriptor': {shape: [1], dataType: 'float16'} 787 }, 788 'inputB': { 789 'data': [ 790 -36.0625, -38.21875, 62.0625, -16.609375, 66, 791 -17.765625, -76, -69.5625, 53.59375, -39.09375, 792 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 793 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 794 -73.25, -33.75, -21.703125, 4.9453125 795 ], 796 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 797 } 798 }, 799 'operators': [{ 800 'name': 'min', 801 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 802 'outputs': 'output' 803 }], 804 'expectedOutputs': { 805 'output': { 806 'data': [ 807 -36.0625, -38.21875, 34.4375, -16.609375, 34.4375, 808 -17.765625, -76, -69.5625, 34.4375, -39.09375, 809 34.4375, -40.40625, 34.4375, 0.0328369140625, 34.4375, 810 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 811 -73.25, -33.75, -21.703125, 4.9453125 812 ], 813 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 814 } 815 } 816 } 817 }, 818 { 819 'name': 'min float16 broadcast 2D to 4D', 820 'graph': { 821 'inputs': { 822 'inputA': { 823 'data': [ 824 -36.0625, -38.21875, 62.0625, -16.609375, 66, 825 -17.765625, -76, -69.5625, 53.59375, -39.09375, 826 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 827 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 828 -73.25, -33.75, -21.703125, 4.9453125 829 ], 830 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 831 }, 832 'inputB': { 833 'data': [-19.078125, -78.25, -13.4375, -93, -72.25, 63.15625], 834 'descriptor': {shape: [2, 3], dataType: 'float16'} 835 } 836 }, 837 'operators': [{ 838 'name': 'min', 839 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 840 'outputs': 'output' 841 }], 842 'expectedOutputs': { 843 'output': { 844 'data': [ 845 -36.0625, -78.25, -13.4375, -93, -72.25, -17.765625, 846 -76, -78.25, -13.4375, -93, -72.25, -40.40625, 847 -19.078125, -78.25, -13.4375, -93, -72.25, -82.3125, 848 -80.5, -78.25, -73.25, -93, -72.25, 4.9453125 849 ], 850 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 851 } 852 } 853 } 854 }, 855 { 856 'name': 'min float16 broadcast 3D to 4D', 857 'graph': { 858 'inputs': { 859 'inputA': { 860 'data': [ 861 -36.0625, -38.21875, 62.0625, -16.609375, 66, 862 -17.765625, -76, -69.5625, 53.59375, -39.09375, 863 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 864 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 865 -73.25, -33.75, -21.703125, 4.9453125 866 ], 867 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 868 }, 869 'inputB': { 870 'data': [23.234375, 84.625, -83.3125, -22.828125], 871 'descriptor': {shape: [2, 2, 1], dataType: 'float16'} 872 } 873 }, 874 'operators': [{ 875 'name': 'min', 876 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 877 'outputs': 'output' 878 }], 879 'expectedOutputs': { 880 'output': { 881 'data': [ 882 -36.0625, -38.21875, 23.234375, -16.609375, 66, 883 -17.765625, -83.3125, -83.3125, -83.3125, -39.09375, 884 -22.828125, -40.40625, 23.234375, 0.0328369140625, 23.234375, 885 -17.71875, 17.390625, -82.3125, -83.3125, -83.3125, 886 -83.3125, -33.75, -22.828125, -22.828125 887 ], 888 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 889 } 890 } 891 } 892 }, 893 { 894 'name': 'min float16 broadcast 4D to 4D', 895 'graph': { 896 'inputs': { 897 'inputA': { 898 'data': [34.4375], 899 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} 900 }, 901 'inputB': { 902 'data': [ 903 -36.0625, -38.21875, 62.0625, -16.609375, 66, 904 -17.765625, -76, -69.5625, 53.59375, -39.09375, 905 96.9375, -40.40625, 74.125, 0.0328369140625, 38.8125, 906 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 907 -73.25, -33.75, -21.703125, 4.9453125 908 ], 909 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 910 } 911 }, 912 'operators': [{ 913 'name': 'min', 914 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 915 'outputs': 'output' 916 }], 917 'expectedOutputs': { 918 'output': { 919 'data': [ 920 -36.0625, -38.21875, 34.4375, -16.609375, 34.4375, 921 -17.765625, -76, -69.5625, 34.4375, -39.09375, 922 34.4375, -40.40625, 34.4375, 0.0328369140625, 34.4375, 923 -17.71875, 17.390625, -82.3125, -80.5, -31.390625, 924 -73.25, -33.75, -21.703125, 4.9453125 925 ], 926 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 927 } 928 } 929 } 930 } 931 ]; 932 933 webnn_conformance_test(minTests, buildAndExecuteGraph, getPrecisionTolerance);