where.https.any.js (74534B)
1 // META: title=test WebNN API where 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-where 12 // Select the values from the input or the other tensor depending on the 13 // corresponding boolean values of the condition tensor. 14 // 15 // MLOperand where(MLOperand condition, MLOperand trueValue, MLOperand 16 // falseValue); 17 18 19 const getWherePrecisionTolerance = () => { 20 return {metricType: 'ULP', value: 0}; 21 }; 22 23 const whereTests = [ 24 { 25 'name': 'where float32 0D scalars', 26 'graph': { 27 'inputs': { 28 'inputCondition': 29 {'data': [247], 'descriptor': {shape: [], dataType: 'uint8'}}, 30 'inputTrueValue': { 31 'data': [-22.83924102783203], 32 'descriptor': {shape: [], dataType: 'float32'} 33 }, 34 'inputFalseValue': { 35 'data': [-50.02232360839844], 36 'descriptor': {shape: [], dataType: 'float32'} 37 } 38 }, 39 'operators': [{ 40 'name': 'where', 41 'arguments': [ 42 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 43 {'falseValue': 'inputFalseValue'} 44 ], 45 'outputs': 'whereOutput' 46 }], 47 'expectedOutputs': { 48 'whereOutput': { 49 'data': [-22.83924102783203], 50 'descriptor': {shape: [], dataType: 'float32'} 51 } 52 } 53 } 54 }, 55 { 56 'name': 'where float32 1D constant tensors', 57 'graph': { 58 'inputs': { 59 'inputCondition': { 60 'data': [ 61 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 62 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 63 ], 64 'descriptor': {shape: [24], dataType: 'uint8'}, 65 'constant': true 66 }, 67 'inputTrueValue': { 68 'data': [ 69 70.27151489257812, 89.99047088623047, -1.5351932048797607, 70 -83.77035522460938, 29.59670639038086, -37.10446548461914, 71 -6.663239002227783, -83.15333557128906, -90.47624206542969, 72 -45.470706939697266, 50.38861083984375, 46.510799407958984, 73 47.503013610839844, -21.95842933654785, 42.89878463745117, 74 -76.8262710571289, 67.0030746459961, 40.09717559814453, 75 -29.081029891967773, -12.19106674194336, -10.8577880859375, 76 -23.302522659301758, 30.851404190063477, -58.82704544067383 77 ], 78 'descriptor': {shape: [24], dataType: 'float32'}, 79 'constant': true 80 }, 81 'inputFalseValue': { 82 'data': [ 83 90.44255065917969, 66.7642593383789, -39.82423782348633, 84 -21.683168411254883, -67.3449478149414, -46.46003341674805, 85 -55.907073974609375, 65.5730209350586, 35.14354705810547, 86 11.960981369018555, 76.65287780761719, 60.741416931152344, 87 -93.93305206298828, -30.397233963012695, 34.315250396728516, 88 7.7088470458984375, -82.2353286743164, 91.12223052978516, 89 22.937334060668945, 74.97810363769531, 18.877336502075195, 90 62.31299591064453, 48.867103576660156, -75.41789245605469 91 ], 92 'descriptor': {shape: [24], dataType: 'float32'}, 93 'constant': true 94 } 95 }, 96 'operators': [{ 97 'name': 'where', 98 'arguments': [ 99 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 100 {'falseValue': 'inputFalseValue'} 101 ], 102 'outputs': 'whereOutput' 103 }], 104 'expectedOutputs': { 105 'whereOutput': { 106 'data': [ 107 70.27151489257812, 66.7642593383789, -1.5351932048797607, 108 -21.683168411254883, 29.59670639038086, -37.10446548461914, 109 -6.663239002227783, 65.5730209350586, -90.47624206542969, 110 -45.470706939697266, 50.38861083984375, 46.510799407958984, 111 47.503013610839844, -21.95842933654785, 42.89878463745117, 112 -76.8262710571289, 67.0030746459961, 40.09717559814453, 113 -29.081029891967773, -12.19106674194336, 18.877336502075195, 114 -23.302522659301758, 30.851404190063477, -75.41789245605469 115 ], 116 'descriptor': {shape: [24], dataType: 'float32'} 117 } 118 } 119 } 120 }, 121 { 122 'name': 'where float32 1D tensors', 123 'graph': { 124 'inputs': { 125 'inputCondition': { 126 'data': [ 127 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 128 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 129 ], 130 'descriptor': {shape: [24], dataType: 'uint8'} 131 }, 132 'inputTrueValue': { 133 'data': [ 134 70.27151489257812, 89.99047088623047, -1.5351932048797607, 135 -83.77035522460938, 29.59670639038086, -37.10446548461914, 136 -6.663239002227783, -83.15333557128906, -90.47624206542969, 137 -45.470706939697266, 50.38861083984375, 46.510799407958984, 138 47.503013610839844, -21.95842933654785, 42.89878463745117, 139 -76.8262710571289, 67.0030746459961, 40.09717559814453, 140 -29.081029891967773, -12.19106674194336, -10.8577880859375, 141 -23.302522659301758, 30.851404190063477, -58.82704544067383 142 ], 143 'descriptor': {shape: [24], dataType: 'float32'} 144 }, 145 'inputFalseValue': { 146 'data': [ 147 90.44255065917969, 66.7642593383789, -39.82423782348633, 148 -21.683168411254883, -67.3449478149414, -46.46003341674805, 149 -55.907073974609375, 65.5730209350586, 35.14354705810547, 150 11.960981369018555, 76.65287780761719, 60.741416931152344, 151 -93.93305206298828, -30.397233963012695, 34.315250396728516, 152 7.7088470458984375, -82.2353286743164, 91.12223052978516, 153 22.937334060668945, 74.97810363769531, 18.877336502075195, 154 62.31299591064453, 48.867103576660156, -75.41789245605469 155 ], 156 'descriptor': {shape: [24], dataType: 'float32'} 157 } 158 }, 159 'operators': [{ 160 'name': 'where', 161 'arguments': [ 162 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 163 {'falseValue': 'inputFalseValue'} 164 ], 165 'outputs': 'whereOutput' 166 }], 167 'expectedOutputs': { 168 'whereOutput': { 169 'data': [ 170 70.27151489257812, 66.7642593383789, -1.5351932048797607, 171 -21.683168411254883, 29.59670639038086, -37.10446548461914, 172 -6.663239002227783, 65.5730209350586, -90.47624206542969, 173 -45.470706939697266, 50.38861083984375, 46.510799407958984, 174 47.503013610839844, -21.95842933654785, 42.89878463745117, 175 -76.8262710571289, 67.0030746459961, 40.09717559814453, 176 -29.081029891967773, -12.19106674194336, 18.877336502075195, 177 -23.302522659301758, 30.851404190063477, -75.41789245605469 178 ], 179 'descriptor': {shape: [24], dataType: 'float32'} 180 } 181 } 182 } 183 }, 184 { 185 'name': 'where float32 2D tensors', 186 'graph': { 187 'inputs': { 188 'inputCondition': { 189 'data': [ 190 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 191 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 192 ], 193 'descriptor': {shape: [4, 6], dataType: 'uint8'} 194 }, 195 'inputTrueValue': { 196 'data': [ 197 70.27151489257812, 89.99047088623047, -1.5351932048797607, 198 -83.77035522460938, 29.59670639038086, -37.10446548461914, 199 -6.663239002227783, -83.15333557128906, -90.47624206542969, 200 -45.470706939697266, 50.38861083984375, 46.510799407958984, 201 47.503013610839844, -21.95842933654785, 42.89878463745117, 202 -76.8262710571289, 67.0030746459961, 40.09717559814453, 203 -29.081029891967773, -12.19106674194336, -10.8577880859375, 204 -23.302522659301758, 30.851404190063477, -58.82704544067383 205 ], 206 'descriptor': {shape: [4, 6], dataType: 'float32'} 207 }, 208 'inputFalseValue': { 209 'data': [ 210 90.44255065917969, 66.7642593383789, -39.82423782348633, 211 -21.683168411254883, -67.3449478149414, -46.46003341674805, 212 -55.907073974609375, 65.5730209350586, 35.14354705810547, 213 11.960981369018555, 76.65287780761719, 60.741416931152344, 214 -93.93305206298828, -30.397233963012695, 34.315250396728516, 215 7.7088470458984375, -82.2353286743164, 91.12223052978516, 216 22.937334060668945, 74.97810363769531, 18.877336502075195, 217 62.31299591064453, 48.867103576660156, -75.41789245605469 218 ], 219 'descriptor': {shape: [4, 6], dataType: 'float32'} 220 } 221 }, 222 'operators': [{ 223 'name': 'where', 224 'arguments': [ 225 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 226 {'falseValue': 'inputFalseValue'} 227 ], 228 'outputs': 'whereOutput' 229 }], 230 'expectedOutputs': { 231 'whereOutput': { 232 'data': [ 233 70.27151489257812, 66.7642593383789, -1.5351932048797607, 234 -21.683168411254883, 29.59670639038086, -37.10446548461914, 235 -6.663239002227783, 65.5730209350586, -90.47624206542969, 236 -45.470706939697266, 50.38861083984375, 46.510799407958984, 237 47.503013610839844, -21.95842933654785, 42.89878463745117, 238 -76.8262710571289, 67.0030746459961, 40.09717559814453, 239 -29.081029891967773, -12.19106674194336, 18.877336502075195, 240 -23.302522659301758, 30.851404190063477, -75.41789245605469 241 ], 242 'descriptor': {shape: [4, 6], dataType: 'float32'} 243 } 244 } 245 } 246 }, 247 { 248 'name': 'where float32 3D tensors', 249 'graph': { 250 'inputs': { 251 'inputCondition': { 252 'data': [ 253 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 254 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 255 ], 256 'descriptor': {shape: [2, 3, 4], dataType: 'uint8'} 257 }, 258 'inputTrueValue': { 259 'data': [ 260 70.27151489257812, 89.99047088623047, -1.5351932048797607, 261 -83.77035522460938, 29.59670639038086, -37.10446548461914, 262 -6.663239002227783, -83.15333557128906, -90.47624206542969, 263 -45.470706939697266, 50.38861083984375, 46.510799407958984, 264 47.503013610839844, -21.95842933654785, 42.89878463745117, 265 -76.8262710571289, 67.0030746459961, 40.09717559814453, 266 -29.081029891967773, -12.19106674194336, -10.8577880859375, 267 -23.302522659301758, 30.851404190063477, -58.82704544067383 268 ], 269 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 270 }, 271 'inputFalseValue': { 272 'data': [ 273 90.44255065917969, 66.7642593383789, -39.82423782348633, 274 -21.683168411254883, -67.3449478149414, -46.46003341674805, 275 -55.907073974609375, 65.5730209350586, 35.14354705810547, 276 11.960981369018555, 76.65287780761719, 60.741416931152344, 277 -93.93305206298828, -30.397233963012695, 34.315250396728516, 278 7.7088470458984375, -82.2353286743164, 91.12223052978516, 279 22.937334060668945, 74.97810363769531, 18.877336502075195, 280 62.31299591064453, 48.867103576660156, -75.41789245605469 281 ], 282 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 283 } 284 }, 285 'operators': [{ 286 'name': 'where', 287 'arguments': [ 288 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 289 {'falseValue': 'inputFalseValue'} 290 ], 291 'outputs': 'whereOutput' 292 }], 293 'expectedOutputs': { 294 'whereOutput': { 295 'data': [ 296 70.27151489257812, 66.7642593383789, -1.5351932048797607, 297 -21.683168411254883, 29.59670639038086, -37.10446548461914, 298 -6.663239002227783, 65.5730209350586, -90.47624206542969, 299 -45.470706939697266, 50.38861083984375, 46.510799407958984, 300 47.503013610839844, -21.95842933654785, 42.89878463745117, 301 -76.8262710571289, 67.0030746459961, 40.09717559814453, 302 -29.081029891967773, -12.19106674194336, 18.877336502075195, 303 -23.302522659301758, 30.851404190063477, -75.41789245605469 304 ], 305 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 306 } 307 } 308 } 309 }, 310 { 311 'name': 'where float32 4D tensors', 312 'graph': { 313 'inputs': { 314 'inputCondition': { 315 'data': [ 316 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 317 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 318 ], 319 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 320 }, 321 'inputTrueValue': { 322 'data': [ 323 70.27151489257812, 89.99047088623047, -1.5351932048797607, 324 -83.77035522460938, 29.59670639038086, -37.10446548461914, 325 -6.663239002227783, -83.15333557128906, -90.47624206542969, 326 -45.470706939697266, 50.38861083984375, 46.510799407958984, 327 47.503013610839844, -21.95842933654785, 42.89878463745117, 328 -76.8262710571289, 67.0030746459961, 40.09717559814453, 329 -29.081029891967773, -12.19106674194336, -10.8577880859375, 330 -23.302522659301758, 30.851404190063477, -58.82704544067383 331 ], 332 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 333 }, 334 'inputFalseValue': { 335 'data': [ 336 90.44255065917969, 66.7642593383789, -39.82423782348633, 337 -21.683168411254883, -67.3449478149414, -46.46003341674805, 338 -55.907073974609375, 65.5730209350586, 35.14354705810547, 339 11.960981369018555, 76.65287780761719, 60.741416931152344, 340 -93.93305206298828, -30.397233963012695, 34.315250396728516, 341 7.7088470458984375, -82.2353286743164, 91.12223052978516, 342 22.937334060668945, 74.97810363769531, 18.877336502075195, 343 62.31299591064453, 48.867103576660156, -75.41789245605469 344 ], 345 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 346 } 347 }, 348 'operators': [{ 349 'name': 'where', 350 'arguments': [ 351 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 352 {'falseValue': 'inputFalseValue'} 353 ], 354 'outputs': 'whereOutput' 355 }], 356 'expectedOutputs': { 357 'whereOutput': { 358 'data': [ 359 70.27151489257812, 66.7642593383789, -1.5351932048797607, 360 -21.683168411254883, 29.59670639038086, -37.10446548461914, 361 -6.663239002227783, 65.5730209350586, -90.47624206542969, 362 -45.470706939697266, 50.38861083984375, 46.510799407958984, 363 47.503013610839844, -21.95842933654785, 42.89878463745117, 364 -76.8262710571289, 67.0030746459961, 40.09717559814453, 365 -29.081029891967773, -12.19106674194336, 18.877336502075195, 366 -23.302522659301758, 30.851404190063477, -75.41789245605469 367 ], 368 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 369 } 370 } 371 } 372 }, 373 { 374 'name': 'where float32 5D tensors', 375 'graph': { 376 'inputs': { 377 'inputCondition': { 378 'data': [ 379 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 380 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 381 ], 382 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'uint8'} 383 }, 384 'inputTrueValue': { 385 'data': [ 386 70.27151489257812, 89.99047088623047, -1.5351932048797607, 387 -83.77035522460938, 29.59670639038086, -37.10446548461914, 388 -6.663239002227783, -83.15333557128906, -90.47624206542969, 389 -45.470706939697266, 50.38861083984375, 46.510799407958984, 390 47.503013610839844, -21.95842933654785, 42.89878463745117, 391 -76.8262710571289, 67.0030746459961, 40.09717559814453, 392 -29.081029891967773, -12.19106674194336, -10.8577880859375, 393 -23.302522659301758, 30.851404190063477, -58.82704544067383 394 ], 395 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 396 }, 397 'inputFalseValue': { 398 'data': [ 399 90.44255065917969, 66.7642593383789, -39.82423782348633, 400 -21.683168411254883, -67.3449478149414, -46.46003341674805, 401 -55.907073974609375, 65.5730209350586, 35.14354705810547, 402 11.960981369018555, 76.65287780761719, 60.741416931152344, 403 -93.93305206298828, -30.397233963012695, 34.315250396728516, 404 7.7088470458984375, -82.2353286743164, 91.12223052978516, 405 22.937334060668945, 74.97810363769531, 18.877336502075195, 406 62.31299591064453, 48.867103576660156, -75.41789245605469 407 ], 408 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 409 } 410 }, 411 'operators': [{ 412 'name': 'where', 413 'arguments': [ 414 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 415 {'falseValue': 'inputFalseValue'} 416 ], 417 'outputs': 'whereOutput' 418 }], 419 'expectedOutputs': { 420 'whereOutput': { 421 'data': [ 422 70.27151489257812, 66.7642593383789, -1.5351932048797607, 423 -21.683168411254883, 29.59670639038086, -37.10446548461914, 424 -6.663239002227783, 65.5730209350586, -90.47624206542969, 425 -45.470706939697266, 50.38861083984375, 46.510799407958984, 426 47.503013610839844, -21.95842933654785, 42.89878463745117, 427 -76.8262710571289, 67.0030746459961, 40.09717559814453, 428 -29.081029891967773, -12.19106674194336, 18.877336502075195, 429 -23.302522659301758, 30.851404190063477, -75.41789245605469 430 ], 431 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 432 } 433 } 434 } 435 }, 436 { 437 'name': 'where float32 4D tensors only broadcast condition 0D to 4D', 438 'graph': { 439 'inputs': { 440 'inputCondition': 441 {'data': [247], 'descriptor': {shape: [], dataType: 'uint8'}}, 442 'inputTrueValue': { 443 'data': [ 444 70.27151489257812, 89.99047088623047, -1.5351932048797607, 445 -83.77035522460938, 29.59670639038086, -37.10446548461914, 446 -6.663239002227783, -83.15333557128906, -90.47624206542969, 447 -45.470706939697266, 50.38861083984375, 46.510799407958984, 448 47.503013610839844, -21.95842933654785, 42.89878463745117, 449 -76.8262710571289, 67.0030746459961, 40.09717559814453, 450 -29.081029891967773, -12.19106674194336, -10.8577880859375, 451 -23.302522659301758, 30.851404190063477, -58.82704544067383 452 ], 453 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 454 }, 455 'inputFalseValue': { 456 'data': [ 457 90.44255065917969, 66.7642593383789, -39.82423782348633, 458 -21.683168411254883, -67.3449478149414, -46.46003341674805, 459 -55.907073974609375, 65.5730209350586, 35.14354705810547, 460 11.960981369018555, 76.65287780761719, 60.741416931152344, 461 -93.93305206298828, -30.397233963012695, 34.315250396728516, 462 7.7088470458984375, -82.2353286743164, 91.12223052978516, 463 22.937334060668945, 74.97810363769531, 18.877336502075195, 464 62.31299591064453, 48.867103576660156, -75.41789245605469 465 ], 466 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 467 } 468 }, 469 'operators': [{ 470 'name': 'where', 471 'arguments': [ 472 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 473 {'falseValue': 'inputFalseValue'} 474 ], 475 'outputs': 'whereOutput' 476 }], 477 'expectedOutputs': { 478 'whereOutput': { 479 'data': [ 480 70.27151489257812, 89.99047088623047, -1.5351932048797607, 481 -83.77035522460938, 29.59670639038086, -37.10446548461914, 482 -6.663239002227783, -83.15333557128906, -90.47624206542969, 483 -45.470706939697266, 50.38861083984375, 46.510799407958984, 484 47.503013610839844, -21.95842933654785, 42.89878463745117, 485 -76.8262710571289, 67.0030746459961, 40.09717559814453, 486 -29.081029891967773, -12.19106674194336, -10.8577880859375, 487 -23.302522659301758, 30.851404190063477, -58.82704544067383 488 ], 489 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 490 } 491 } 492 } 493 }, 494 { 495 'name': 'where float32 4D tensors only broadcast condition 1D to 4D', 496 'graph': { 497 'inputs': { 498 'inputCondition': { 499 'data': [253, 222, 0], 500 'descriptor': {shape: [3], dataType: 'uint8'} 501 }, 502 'inputTrueValue': { 503 'data': [ 504 70.27151489257812, 89.99047088623047, -1.5351932048797607, 505 -83.77035522460938, 29.59670639038086, -37.10446548461914, 506 -6.663239002227783, -83.15333557128906, -90.47624206542969, 507 -45.470706939697266, 50.38861083984375, 46.510799407958984, 508 47.503013610839844, -21.95842933654785, 42.89878463745117, 509 -76.8262710571289, 67.0030746459961, 40.09717559814453, 510 -29.081029891967773, -12.19106674194336, -10.8577880859375, 511 -23.302522659301758, 30.851404190063477, -58.82704544067383 512 ], 513 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 514 }, 515 'inputFalseValue': { 516 'data': [ 517 90.44255065917969, 66.7642593383789, -39.82423782348633, 518 -21.683168411254883, -67.3449478149414, -46.46003341674805, 519 -55.907073974609375, 65.5730209350586, 35.14354705810547, 520 11.960981369018555, 76.65287780761719, 60.741416931152344, 521 -93.93305206298828, -30.397233963012695, 34.315250396728516, 522 7.7088470458984375, -82.2353286743164, 91.12223052978516, 523 22.937334060668945, 74.97810363769531, 18.877336502075195, 524 62.31299591064453, 48.867103576660156, -75.41789245605469 525 ], 526 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 527 } 528 }, 529 'operators': [{ 530 'name': 'where', 531 'arguments': [ 532 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 533 {'falseValue': 'inputFalseValue'} 534 ], 535 'outputs': 'whereOutput' 536 }], 537 'expectedOutputs': { 538 'whereOutput': { 539 'data': [ 540 70.27151489257812, 89.99047088623047, -39.82423782348633, 541 -83.77035522460938, 29.59670639038086, -46.46003341674805, 542 -6.663239002227783, -83.15333557128906, 35.14354705810547, 543 -45.470706939697266, 50.38861083984375, 60.741416931152344, 544 47.503013610839844, -21.95842933654785, 34.315250396728516, 545 -76.8262710571289, 67.0030746459961, 91.12223052978516, 546 -29.081029891967773, -12.19106674194336, 18.877336502075195, 547 -23.302522659301758, 30.851404190063477, -75.41789245605469 548 ], 549 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 550 } 551 } 552 } 553 }, 554 { 555 'name': 'where float32 4D tensors only broadcast condition 2D to 4D', 556 'graph': { 557 'inputs': { 558 'inputCondition': { 559 'data': [103, 0], 560 'descriptor': {shape: [2, 1], dataType: 'uint8'} 561 }, 562 'inputTrueValue': { 563 'data': [ 564 70.27151489257812, 89.99047088623047, -1.5351932048797607, 565 -83.77035522460938, 29.59670639038086, -37.10446548461914, 566 -6.663239002227783, -83.15333557128906, -90.47624206542969, 567 -45.470706939697266, 50.38861083984375, 46.510799407958984, 568 47.503013610839844, -21.95842933654785, 42.89878463745117, 569 -76.8262710571289, 67.0030746459961, 40.09717559814453, 570 -29.081029891967773, -12.19106674194336, -10.8577880859375, 571 -23.302522659301758, 30.851404190063477, -58.82704544067383 572 ], 573 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 574 }, 575 'inputFalseValue': { 576 'data': [ 577 90.44255065917969, 66.7642593383789, -39.82423782348633, 578 -21.683168411254883, -67.3449478149414, -46.46003341674805, 579 -55.907073974609375, 65.5730209350586, 35.14354705810547, 580 11.960981369018555, 76.65287780761719, 60.741416931152344, 581 -93.93305206298828, -30.397233963012695, 34.315250396728516, 582 7.7088470458984375, -82.2353286743164, 91.12223052978516, 583 22.937334060668945, 74.97810363769531, 18.877336502075195, 584 62.31299591064453, 48.867103576660156, -75.41789245605469 585 ], 586 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 587 } 588 }, 589 'operators': [{ 590 'name': 'where', 591 'arguments': [ 592 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 593 {'falseValue': 'inputFalseValue'} 594 ], 595 'outputs': 'whereOutput' 596 }], 597 'expectedOutputs': { 598 'whereOutput': { 599 'data': [ 600 70.27151489257812, 89.99047088623047, -1.5351932048797607, 601 -21.683168411254883, -67.3449478149414, -46.46003341674805, 602 -6.663239002227783, -83.15333557128906, -90.47624206542969, 603 11.960981369018555, 76.65287780761719, 60.741416931152344, 604 47.503013610839844, -21.95842933654785, 42.89878463745117, 605 7.7088470458984375, -82.2353286743164, 91.12223052978516, 606 -29.081029891967773, -12.19106674194336, -10.8577880859375, 607 62.31299591064453, 48.867103576660156, -75.41789245605469 608 ], 609 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 610 } 611 } 612 } 613 }, 614 { 615 'name': 'where float32 4D tensors only broadcast condition 3D to 4D', 616 'graph': { 617 'inputs': { 618 'inputCondition': { 619 'data': [235, 0, 93, 213, 0, 117], 620 'descriptor': {shape: [1, 2, 3], dataType: 'uint8'} 621 }, 622 'inputTrueValue': { 623 'data': [ 624 70.27151489257812, 89.99047088623047, -1.5351932048797607, 625 -83.77035522460938, 29.59670639038086, -37.10446548461914, 626 -6.663239002227783, -83.15333557128906, -90.47624206542969, 627 -45.470706939697266, 50.38861083984375, 46.510799407958984, 628 47.503013610839844, -21.95842933654785, 42.89878463745117, 629 -76.8262710571289, 67.0030746459961, 40.09717559814453, 630 -29.081029891967773, -12.19106674194336, -10.8577880859375, 631 -23.302522659301758, 30.851404190063477, -58.82704544067383 632 ], 633 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 634 }, 635 'inputFalseValue': { 636 'data': [ 637 90.44255065917969, 66.7642593383789, -39.82423782348633, 638 -21.683168411254883, -67.3449478149414, -46.46003341674805, 639 -55.907073974609375, 65.5730209350586, 35.14354705810547, 640 11.960981369018555, 76.65287780761719, 60.741416931152344, 641 -93.93305206298828, -30.397233963012695, 34.315250396728516, 642 7.7088470458984375, -82.2353286743164, 91.12223052978516, 643 22.937334060668945, 74.97810363769531, 18.877336502075195, 644 62.31299591064453, 48.867103576660156, -75.41789245605469 645 ], 646 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 647 } 648 }, 649 'operators': [{ 650 'name': 'where', 651 'arguments': [ 652 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 653 {'falseValue': 'inputFalseValue'} 654 ], 655 'outputs': 'whereOutput' 656 }], 657 'expectedOutputs': { 658 'whereOutput': { 659 'data': [ 660 70.27151489257812, 66.7642593383789, -1.5351932048797607, 661 -83.77035522460938, -67.3449478149414, -37.10446548461914, 662 -6.663239002227783, 65.5730209350586, -90.47624206542969, 663 -45.470706939697266, 76.65287780761719, 46.510799407958984, 664 47.503013610839844, -30.397233963012695, 42.89878463745117, 665 -76.8262710571289, -82.2353286743164, 40.09717559814453, 666 -29.081029891967773, 74.97810363769531, -10.8577880859375, 667 -23.302522659301758, 48.867103576660156, -58.82704544067383 668 ], 669 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 670 } 671 } 672 } 673 }, 674 { 675 'name': 'where float32 4D tensors only broadcast condition 4D to 4D', 676 'graph': { 677 'inputs': { 678 'inputCondition': { 679 'data': [0, 165, 0, 90], 680 'descriptor': {shape: [1, 2, 2, 1], dataType: 'uint8'} 681 }, 682 'inputTrueValue': { 683 'data': [ 684 70.27151489257812, 89.99047088623047, -1.5351932048797607, 685 -83.77035522460938, 29.59670639038086, -37.10446548461914, 686 -6.663239002227783, -83.15333557128906, -90.47624206542969, 687 -45.470706939697266, 50.38861083984375, 46.510799407958984, 688 47.503013610839844, -21.95842933654785, 42.89878463745117, 689 -76.8262710571289, 67.0030746459961, 40.09717559814453, 690 -29.081029891967773, -12.19106674194336, -10.8577880859375, 691 -23.302522659301758, 30.851404190063477, -58.82704544067383 692 ], 693 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 694 }, 695 'inputFalseValue': { 696 'data': [ 697 90.44255065917969, 66.7642593383789, -39.82423782348633, 698 -21.683168411254883, -67.3449478149414, -46.46003341674805, 699 -55.907073974609375, 65.5730209350586, 35.14354705810547, 700 11.960981369018555, 76.65287780761719, 60.741416931152344, 701 -93.93305206298828, -30.397233963012695, 34.315250396728516, 702 7.7088470458984375, -82.2353286743164, 91.12223052978516, 703 22.937334060668945, 74.97810363769531, 18.877336502075195, 704 62.31299591064453, 48.867103576660156, -75.41789245605469 705 ], 706 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 707 } 708 }, 709 'operators': [{ 710 'name': 'where', 711 'arguments': [ 712 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 713 {'falseValue': 'inputFalseValue'} 714 ], 715 'outputs': 'whereOutput' 716 }], 717 'expectedOutputs': { 718 'whereOutput': { 719 'data': [ 720 90.44255065917969, 66.7642593383789, -39.82423782348633, 721 -83.77035522460938, 29.59670639038086, -37.10446548461914, 722 -55.907073974609375, 65.5730209350586, 35.14354705810547, 723 -45.470706939697266, 50.38861083984375, 46.510799407958984, 724 -93.93305206298828, -30.397233963012695, 34.315250396728516, 725 -76.8262710571289, 67.0030746459961, 40.09717559814453, 726 22.937334060668945, 74.97810363769531, 18.877336502075195, 727 -23.302522659301758, 30.851404190063477, -58.82704544067383 728 ], 729 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 730 } 731 } 732 } 733 }, 734 { 735 'name': 'where float32 4D tensors only broadcast trueValues 2D to 4D', 736 'graph': { 737 'inputs': { 738 'inputCondition': { 739 'data': [ 740 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 741 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 742 ], 743 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 744 }, 745 'inputTrueValue': { 746 'data': [ 747 38.77214050292969, 18.20477294921875, -11.542049407958984, 748 -82.74693298339844, -18.61202621459961, -75.77534484863281 749 ], 750 'descriptor': {shape: [2, 3], dataType: 'float32'} 751 }, 752 'inputFalseValue': { 753 'data': [ 754 90.44255065917969, 66.7642593383789, -39.82423782348633, 755 -21.683168411254883, -67.3449478149414, -46.46003341674805, 756 -55.907073974609375, 65.5730209350586, 35.14354705810547, 757 11.960981369018555, 76.65287780761719, 60.741416931152344, 758 -93.93305206298828, -30.397233963012695, 34.315250396728516, 759 7.7088470458984375, -82.2353286743164, 91.12223052978516, 760 22.937334060668945, 74.97810363769531, 18.877336502075195, 761 62.31299591064453, 48.867103576660156, -75.41789245605469 762 ], 763 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 764 } 765 }, 766 'operators': [{ 767 'name': 'where', 768 'arguments': [ 769 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 770 {'falseValue': 'inputFalseValue'} 771 ], 772 'outputs': 'whereOutput' 773 }], 774 'expectedOutputs': { 775 'whereOutput': { 776 'data': [ 777 38.77214050292969, 66.7642593383789, -11.542049407958984, 778 -21.683168411254883, -18.61202621459961, -75.77534484863281, 779 38.77214050292969, 65.5730209350586, -11.542049407958984, 780 -82.74693298339844, -18.61202621459961, -75.77534484863281, 781 38.77214050292969, 18.20477294921875, -11.542049407958984, 782 -82.74693298339844, -18.61202621459961, -75.77534484863281, 783 38.77214050292969, 18.20477294921875, 18.877336502075195, 784 -82.74693298339844, -18.61202621459961, -75.41789245605469 785 ], 786 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 787 } 788 } 789 } 790 }, 791 { 792 'name': 'where float32 4D tensors only broadcast trueValues 4D to 4D', 793 'graph': { 794 'inputs': { 795 'inputCondition': { 796 'data': [ 797 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 798 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 799 ], 800 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 801 }, 802 'inputTrueValue': { 803 'data': [ 804 -29.164173126220703, 32.200286865234375, -6.146966457366943, 805 -24.822790145874023 806 ], 807 'descriptor': {shape: [2, 2, 1, 1], dataType: 'float32'} 808 }, 809 'inputFalseValue': { 810 'data': [ 811 90.44255065917969, 66.7642593383789, -39.82423782348633, 812 -21.683168411254883, -67.3449478149414, -46.46003341674805, 813 -55.907073974609375, 65.5730209350586, 35.14354705810547, 814 11.960981369018555, 76.65287780761719, 60.741416931152344, 815 -93.93305206298828, -30.397233963012695, 34.315250396728516, 816 7.7088470458984375, -82.2353286743164, 91.12223052978516, 817 22.937334060668945, 74.97810363769531, 18.877336502075195, 818 62.31299591064453, 48.867103576660156, -75.41789245605469 819 ], 820 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 821 } 822 }, 823 'operators': [{ 824 'name': 'where', 825 'arguments': [ 826 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 827 {'falseValue': 'inputFalseValue'} 828 ], 829 'outputs': 'whereOutput' 830 }], 831 'expectedOutputs': { 832 'whereOutput': { 833 'data': [ 834 -29.164173126220703, 66.7642593383789, -29.164173126220703, 835 -21.683168411254883, -29.164173126220703, -29.164173126220703, 836 32.200286865234375, 65.5730209350586, 32.200286865234375, 837 32.200286865234375, 32.200286865234375, 32.200286865234375, 838 -6.146966457366943, -6.146966457366943, -6.146966457366943, 839 -6.146966457366943, -6.146966457366943, -6.146966457366943, 840 -24.822790145874023, -24.822790145874023, 18.877336502075195, 841 -24.822790145874023, -24.822790145874023, -75.41789245605469 842 ], 843 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 844 } 845 } 846 } 847 }, 848 { 849 'name': 'where float32 4D tensors only broadcast falseValues 3D to 4D', 850 'graph': { 851 'inputs': { 852 'inputCondition': { 853 'data': [ 854 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 855 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 856 ], 857 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 858 }, 859 'inputTrueValue': { 860 'data': [ 861 70.27151489257812, 89.99047088623047, -1.5351932048797607, 862 -83.77035522460938, 29.59670639038086, -37.10446548461914, 863 -6.663239002227783, -83.15333557128906, -90.47624206542969, 864 -45.470706939697266, 50.38861083984375, 46.510799407958984, 865 47.503013610839844, -21.95842933654785, 42.89878463745117, 866 -76.8262710571289, 67.0030746459961, 40.09717559814453, 867 -29.081029891967773, -12.19106674194336, -10.8577880859375, 868 -23.302522659301758, 30.851404190063477, -58.82704544067383 869 ], 870 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 871 }, 872 'inputFalseValue': { 873 'data': [ 874 -86.59848022460938, -67.72773742675781, -30.731334686279297, 875 -93.49223327636719 876 ], 877 'descriptor': {shape: [2, 2, 1], dataType: 'float32'} 878 } 879 }, 880 'operators': [{ 881 'name': 'where', 882 'arguments': [ 883 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 884 {'falseValue': 'inputFalseValue'} 885 ], 886 'outputs': 'whereOutput' 887 }], 888 'expectedOutputs': { 889 'whereOutput': { 890 'data': [ 891 70.27151489257812, -86.59848022460938, -1.5351932048797607, 892 -67.72773742675781, 29.59670639038086, -37.10446548461914, 893 -6.663239002227783, -30.731334686279297, -90.47624206542969, 894 -45.470706939697266, 50.38861083984375, 46.510799407958984, 895 47.503013610839844, -21.95842933654785, 42.89878463745117, 896 -76.8262710571289, 67.0030746459961, 40.09717559814453, 897 -29.081029891967773, -12.19106674194336, -30.731334686279297, 898 -23.302522659301758, 30.851404190063477, -93.49223327636719 899 ], 900 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 901 } 902 } 903 } 904 }, 905 { 906 'name': 'where float32 4D tensors only broadcast falseValues 4D to 4D', 907 'graph': { 908 'inputs': { 909 'inputCondition': { 910 'data': [ 911 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 912 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 913 ], 914 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 915 }, 916 'inputTrueValue': { 917 'data': [ 918 70.27151489257812, 89.99047088623047, -1.5351932048797607, 919 -83.77035522460938, 29.59670639038086, -37.10446548461914, 920 -6.663239002227783, -83.15333557128906, -90.47624206542969, 921 -45.470706939697266, 50.38861083984375, 46.510799407958984, 922 47.503013610839844, -21.95842933654785, 42.89878463745117, 923 -76.8262710571289, 67.0030746459961, 40.09717559814453, 924 -29.081029891967773, -12.19106674194336, -10.8577880859375, 925 -23.302522659301758, 30.851404190063477, -58.82704544067383 926 ], 927 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 928 }, 929 'inputFalseValue': { 930 'data': [ 931 17.777414321899414, -1.9890096187591553, -57.28207015991211, 932 -80.01390838623047, 66.87323760986328, -31.328258514404297 933 ], 934 'descriptor': {shape: [1, 2, 1, 3], dataType: 'float32'} 935 } 936 }, 937 'operators': [{ 938 'name': 'where', 939 'arguments': [ 940 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 941 {'falseValue': 'inputFalseValue'} 942 ], 943 'outputs': 'whereOutput' 944 }], 945 'expectedOutputs': { 946 'whereOutput': { 947 'data': [ 948 70.27151489257812, -1.9890096187591553, -1.5351932048797607, 949 17.777414321899414, 29.59670639038086, -37.10446548461914, 950 -6.663239002227783, 66.87323760986328, -90.47624206542969, 951 -45.470706939697266, 50.38861083984375, 46.510799407958984, 952 47.503013610839844, -21.95842933654785, 42.89878463745117, 953 -76.8262710571289, 67.0030746459961, 40.09717559814453, 954 -29.081029891967773, -12.19106674194336, -31.328258514404297, 955 -23.302522659301758, 30.851404190063477, -31.328258514404297 956 ], 957 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 958 } 959 } 960 } 961 }, 962 { 963 'name': 'where float32 4D tensors all broadcast 4D', 964 'graph': { 965 'inputs': { 966 'inputCondition': { 967 'data': [58, 217], 968 'descriptor': {shape: [2, 1, 1, 1], dataType: 'uint8'} 969 }, 970 'inputTrueValue': { 971 'data': [ 972 38.77214050292969, 18.20477294921875, -11.542049407958984, 973 -82.74693298339844, -18.61202621459961, -75.77534484863281 974 ], 975 'descriptor': {shape: [2, 3], dataType: 'float32'} 976 }, 977 'inputFalseValue': { 978 'data': [ 979 -86.59848022460938, -67.72773742675781, -30.731334686279297, 980 -93.49223327636719 981 ], 982 'descriptor': {shape: [2, 2, 1], dataType: 'float32'} 983 } 984 }, 985 'operators': [{ 986 'name': 'where', 987 'arguments': [ 988 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 989 {'falseValue': 'inputFalseValue'} 990 ], 991 'outputs': 'whereOutput' 992 }], 993 'expectedOutputs': { 994 'whereOutput': { 995 'data': [ 996 38.77214050292969, 18.20477294921875, -11.542049407958984, 997 -82.74693298339844, -18.61202621459961, -75.77534484863281, 998 38.77214050292969, 18.20477294921875, -11.542049407958984, 999 -82.74693298339844, -18.61202621459961, -75.77534484863281, 1000 38.77214050292969, 18.20477294921875, -11.542049407958984, 1001 -82.74693298339844, -18.61202621459961, -75.77534484863281, 1002 38.77214050292969, 18.20477294921875, -11.542049407958984, 1003 -82.74693298339844, -18.61202621459961, -75.77534484863281 1004 ], 1005 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 1006 } 1007 } 1008 } 1009 }, 1010 1011 // float16 tests 1012 { 1013 'name': 'where float16 0D scalars', 1014 'graph': { 1015 'inputs': { 1016 'inputCondition': 1017 {'data': [247], 'descriptor': {shape: [], dataType: 'uint8'}}, 1018 'inputTrueValue': { 1019 'data': [-22.84375], 1020 'descriptor': {shape: [], dataType: 'float16'} 1021 }, 1022 'inputFalseValue': { 1023 'data': [-50.03125], 1024 'descriptor': {shape: [], dataType: 'float16'} 1025 } 1026 }, 1027 'operators': [{ 1028 'name': 'where', 1029 'arguments': [ 1030 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1031 {'falseValue': 'inputFalseValue'} 1032 ], 1033 'outputs': 'whereOutput' 1034 }], 1035 'expectedOutputs': { 1036 'whereOutput': { 1037 'data': [-22.84375], 1038 'descriptor': {shape: [], dataType: 'float16'} 1039 } 1040 } 1041 } 1042 }, 1043 { 1044 'name': 'where float16 1D constant tensors', 1045 'graph': { 1046 'inputs': { 1047 'inputCondition': { 1048 'data': [ 1049 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1050 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1051 ], 1052 'descriptor': {shape: [24], dataType: 'uint8'}, 1053 'constant': true 1054 }, 1055 'inputTrueValue': { 1056 'data': [ 1057 70.25, 90, -1.53515625, -83.75, 29.59375, 1058 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1059 50.375, 46.5, 47.5, -21.953125, 42.90625, 1060 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1061 -10.859375, -23.296875, 30.84375, -58.8125 1062 ], 1063 'descriptor': {shape: [24], dataType: 'float16'}, 1064 'constant': true 1065 }, 1066 'inputFalseValue': { 1067 'data': [ 1068 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1069 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1070 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1071 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1072 ], 1073 'descriptor': {shape: [24], dataType: 'float16'}, 1074 'constant': true 1075 } 1076 }, 1077 'operators': [{ 1078 'name': 'where', 1079 'arguments': [ 1080 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1081 {'falseValue': 'inputFalseValue'} 1082 ], 1083 'outputs': 'whereOutput' 1084 }], 1085 'expectedOutputs': { 1086 'whereOutput': { 1087 'data': [ 1088 70.25, 66.75, -1.53515625, -21.6875, 29.59375, 1089 -37.09375, -6.6640625, 65.5625, -90.5, -45.46875, 1090 50.375, 46.5, 47.5, -21.953125, 42.90625, 1091 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1092 18.875, -23.296875, 30.84375, -75.4375 1093 ], 1094 'descriptor': {shape: [24], dataType: 'float16'} 1095 } 1096 } 1097 } 1098 }, 1099 { 1100 'name': 'where float16 1D tensors', 1101 'graph': { 1102 'inputs': { 1103 'inputCondition': { 1104 'data': [ 1105 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1106 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1107 ], 1108 'descriptor': {shape: [24], dataType: 'uint8'} 1109 }, 1110 'inputTrueValue': { 1111 'data': [ 1112 70.25, 90, -1.53515625, -83.75, 29.59375, 1113 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1114 50.375, 46.5, 47.5, -21.953125, 42.90625, 1115 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1116 -10.859375, -23.296875, 30.84375, -58.8125 1117 ], 1118 'descriptor': {shape: [24], dataType: 'float16'} 1119 }, 1120 'inputFalseValue': { 1121 'data': [ 1122 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1123 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1124 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1125 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1126 ], 1127 'descriptor': {shape: [24], dataType: 'float16'} 1128 } 1129 }, 1130 'operators': [{ 1131 'name': 'where', 1132 'arguments': [ 1133 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1134 {'falseValue': 'inputFalseValue'} 1135 ], 1136 'outputs': 'whereOutput' 1137 }], 1138 'expectedOutputs': { 1139 'whereOutput': { 1140 'data': [ 1141 70.25, 66.75, -1.53515625, -21.6875, 29.59375, 1142 -37.09375, -6.6640625, 65.5625, -90.5, -45.46875, 1143 50.375, 46.5, 47.5, -21.953125, 42.90625, 1144 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1145 18.875, -23.296875, 30.84375, -75.4375 1146 ], 1147 'descriptor': {shape: [24], dataType: 'float16'} 1148 } 1149 } 1150 } 1151 }, 1152 { 1153 'name': 'where float16 2D tensors', 1154 'graph': { 1155 'inputs': { 1156 'inputCondition': { 1157 'data': [ 1158 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1159 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1160 ], 1161 'descriptor': {shape: [4, 6], dataType: 'uint8'} 1162 }, 1163 'inputTrueValue': { 1164 'data': [ 1165 70.25, 90, -1.53515625, -83.75, 29.59375, 1166 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1167 50.375, 46.5, 47.5, -21.953125, 42.90625, 1168 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1169 -10.859375, -23.296875, 30.84375, -58.8125 1170 ], 1171 'descriptor': {shape: [4, 6], dataType: 'float16'} 1172 }, 1173 'inputFalseValue': { 1174 'data': [ 1175 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1176 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1177 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1178 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1179 ], 1180 'descriptor': {shape: [4, 6], dataType: 'float16'} 1181 } 1182 }, 1183 'operators': [{ 1184 'name': 'where', 1185 'arguments': [ 1186 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1187 {'falseValue': 'inputFalseValue'} 1188 ], 1189 'outputs': 'whereOutput' 1190 }], 1191 'expectedOutputs': { 1192 'whereOutput': { 1193 'data': [ 1194 70.25, 66.75, -1.53515625, -21.6875, 29.59375, 1195 -37.09375, -6.6640625, 65.5625, -90.5, -45.46875, 1196 50.375, 46.5, 47.5, -21.953125, 42.90625, 1197 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1198 18.875, -23.296875, 30.84375, -75.4375 1199 ], 1200 'descriptor': {shape: [4, 6], dataType: 'float16'} 1201 } 1202 } 1203 } 1204 }, 1205 { 1206 'name': 'where float16 3D tensors', 1207 'graph': { 1208 'inputs': { 1209 'inputCondition': { 1210 'data': [ 1211 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1212 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1213 ], 1214 'descriptor': {shape: [2, 3, 4], dataType: 'uint8'} 1215 }, 1216 'inputTrueValue': { 1217 'data': [ 1218 70.25, 90, -1.53515625, -83.75, 29.59375, 1219 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1220 50.375, 46.5, 47.5, -21.953125, 42.90625, 1221 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1222 -10.859375, -23.296875, 30.84375, -58.8125 1223 ], 1224 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 1225 }, 1226 'inputFalseValue': { 1227 'data': [ 1228 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1229 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1230 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1231 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1232 ], 1233 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 1234 } 1235 }, 1236 'operators': [{ 1237 'name': 'where', 1238 'arguments': [ 1239 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1240 {'falseValue': 'inputFalseValue'} 1241 ], 1242 'outputs': 'whereOutput' 1243 }], 1244 'expectedOutputs': { 1245 'whereOutput': { 1246 'data': [ 1247 70.25, 66.75, -1.53515625, -21.6875, 29.59375, 1248 -37.09375, -6.6640625, 65.5625, -90.5, -45.46875, 1249 50.375, 46.5, 47.5, -21.953125, 42.90625, 1250 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1251 18.875, -23.296875, 30.84375, -75.4375 1252 ], 1253 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 1254 } 1255 } 1256 } 1257 }, 1258 { 1259 'name': 'where float16 4D tensors', 1260 'graph': { 1261 'inputs': { 1262 'inputCondition': { 1263 'data': [ 1264 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1265 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1266 ], 1267 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 1268 }, 1269 'inputTrueValue': { 1270 'data': [ 1271 70.25, 90, -1.53515625, -83.75, 29.59375, 1272 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1273 50.375, 46.5, 47.5, -21.953125, 42.90625, 1274 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1275 -10.859375, -23.296875, 30.84375, -58.8125 1276 ], 1277 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1278 }, 1279 'inputFalseValue': { 1280 'data': [ 1281 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1282 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1283 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1284 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1285 ], 1286 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1287 } 1288 }, 1289 'operators': [{ 1290 'name': 'where', 1291 'arguments': [ 1292 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1293 {'falseValue': 'inputFalseValue'} 1294 ], 1295 'outputs': 'whereOutput' 1296 }], 1297 'expectedOutputs': { 1298 'whereOutput': { 1299 'data': [ 1300 70.25, 66.75, -1.53515625, -21.6875, 29.59375, 1301 -37.09375, -6.6640625, 65.5625, -90.5, -45.46875, 1302 50.375, 46.5, 47.5, -21.953125, 42.90625, 1303 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1304 18.875, -23.296875, 30.84375, -75.4375 1305 ], 1306 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1307 } 1308 } 1309 } 1310 }, 1311 { 1312 'name': 'where float16 5D tensors', 1313 'graph': { 1314 'inputs': { 1315 'inputCondition': { 1316 'data': [ 1317 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1318 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1319 ], 1320 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'uint8'} 1321 }, 1322 'inputTrueValue': { 1323 'data': [ 1324 70.25, 90, -1.53515625, -83.75, 29.59375, 1325 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1326 50.375, 46.5, 47.5, -21.953125, 42.90625, 1327 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1328 -10.859375, -23.296875, 30.84375, -58.8125 1329 ], 1330 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 1331 }, 1332 'inputFalseValue': { 1333 'data': [ 1334 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1335 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1336 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1337 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1338 ], 1339 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 1340 } 1341 }, 1342 'operators': [{ 1343 'name': 'where', 1344 'arguments': [ 1345 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1346 {'falseValue': 'inputFalseValue'} 1347 ], 1348 'outputs': 'whereOutput' 1349 }], 1350 'expectedOutputs': { 1351 'whereOutput': { 1352 'data': [ 1353 70.25, 66.75, -1.53515625, -21.6875, 29.59375, 1354 -37.09375, -6.6640625, 65.5625, -90.5, -45.46875, 1355 50.375, 46.5, 47.5, -21.953125, 42.90625, 1356 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1357 18.875, -23.296875, 30.84375, -75.4375 1358 ], 1359 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 1360 } 1361 } 1362 } 1363 }, 1364 { 1365 'name': 'where float16 4D tensors only broadcast condition 0D to 4D', 1366 'graph': { 1367 'inputs': { 1368 'inputCondition': 1369 {'data': [247], 'descriptor': {shape: [], dataType: 'uint8'}}, 1370 'inputTrueValue': { 1371 'data': [ 1372 70.25, 90, -1.53515625, -83.75, 29.59375, 1373 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1374 50.375, 46.5, 47.5, -21.953125, 42.90625, 1375 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1376 -10.859375, -23.296875, 30.84375, -58.8125 1377 ], 1378 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1379 }, 1380 'inputFalseValue': { 1381 'data': [ 1382 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1383 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1384 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1385 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1386 ], 1387 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1388 } 1389 }, 1390 'operators': [{ 1391 'name': 'where', 1392 'arguments': [ 1393 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1394 {'falseValue': 'inputFalseValue'} 1395 ], 1396 'outputs': 'whereOutput' 1397 }], 1398 'expectedOutputs': { 1399 'whereOutput': { 1400 'data': [ 1401 70.25, 90, -1.53515625, -83.75, 29.59375, 1402 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1403 50.375, 46.5, 47.5, -21.953125, 42.90625, 1404 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1405 -10.859375, -23.296875, 30.84375, -58.8125 1406 ], 1407 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1408 } 1409 } 1410 } 1411 }, 1412 { 1413 'name': 'where float16 4D tensors only broadcast condition 1D to 4D', 1414 'graph': { 1415 'inputs': { 1416 'inputCondition': { 1417 'data': [253, 222, 0], 1418 'descriptor': {shape: [3], dataType: 'uint8'} 1419 }, 1420 'inputTrueValue': { 1421 'data': [ 1422 70.25, 90, -1.53515625, -83.75, 29.59375, 1423 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1424 50.375, 46.5, 47.5, -21.953125, 42.90625, 1425 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1426 -10.859375, -23.296875, 30.84375, -58.8125 1427 ], 1428 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1429 }, 1430 'inputFalseValue': { 1431 'data': [ 1432 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1433 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1434 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1435 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1436 ], 1437 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1438 } 1439 }, 1440 'operators': [{ 1441 'name': 'where', 1442 'arguments': [ 1443 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1444 {'falseValue': 'inputFalseValue'} 1445 ], 1446 'outputs': 'whereOutput' 1447 }], 1448 'expectedOutputs': { 1449 'whereOutput': { 1450 'data': [ 1451 70.25, 90, -39.8125, -83.75, 29.59375, -46.46875, 1452 -6.6640625, -83.125, 35.15625, -45.46875, 50.375, 60.75, 1453 47.5, -21.953125, 34.3125, -76.8125, 67, 91.125, 1454 -29.078125, -12.1875, 18.875, -23.296875, 30.84375, -75.4375 1455 ], 1456 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1457 } 1458 } 1459 } 1460 }, 1461 { 1462 'name': 'where float16 4D tensors only broadcast condition 2D to 4D', 1463 'graph': { 1464 'inputs': { 1465 'inputCondition': { 1466 'data': [103, 0], 1467 'descriptor': {shape: [2, 1], dataType: 'uint8'} 1468 }, 1469 'inputTrueValue': { 1470 'data': [ 1471 70.25, 90, -1.53515625, -83.75, 29.59375, 1472 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1473 50.375, 46.5, 47.5, -21.953125, 42.90625, 1474 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1475 -10.859375, -23.296875, 30.84375, -58.8125 1476 ], 1477 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1478 }, 1479 'inputFalseValue': { 1480 'data': [ 1481 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1482 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1483 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1484 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1485 ], 1486 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1487 } 1488 }, 1489 'operators': [{ 1490 'name': 'where', 1491 'arguments': [ 1492 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1493 {'falseValue': 'inputFalseValue'} 1494 ], 1495 'outputs': 'whereOutput' 1496 }], 1497 'expectedOutputs': { 1498 'whereOutput': { 1499 'data': [ 1500 70.25, 90, -1.53515625, -21.6875, -67.375, -46.46875, 1501 -6.6640625, -83.125, -90.5, 11.9609375, 76.625, 60.75, 1502 47.5, -21.953125, 42.90625, 7.70703125, -82.25, 91.125, 1503 -29.078125, -12.1875, -10.859375, 62.3125, 48.875, -75.4375 1504 ], 1505 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1506 } 1507 } 1508 } 1509 }, 1510 { 1511 'name': 'where float16 4D tensors only broadcast condition 3D to 4D', 1512 'graph': { 1513 'inputs': { 1514 'inputCondition': { 1515 'data': [235, 0, 93, 213, 0, 117], 1516 'descriptor': {shape: [1, 2, 3], dataType: 'uint8'} 1517 }, 1518 'inputTrueValue': { 1519 'data': [ 1520 70.25, 90, -1.53515625, -83.75, 29.59375, 1521 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1522 50.375, 46.5, 47.5, -21.953125, 42.90625, 1523 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1524 -10.859375, -23.296875, 30.84375, -58.8125 1525 ], 1526 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1527 }, 1528 'inputFalseValue': { 1529 'data': [ 1530 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1531 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1532 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1533 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1534 ], 1535 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1536 } 1537 }, 1538 'operators': [{ 1539 'name': 'where', 1540 'arguments': [ 1541 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1542 {'falseValue': 'inputFalseValue'} 1543 ], 1544 'outputs': 'whereOutput' 1545 }], 1546 'expectedOutputs': { 1547 'whereOutput': { 1548 'data': [ 1549 70.25, 66.75, -1.53515625, -83.75, -67.375, -37.09375, 1550 -6.6640625, 65.5625, -90.5, -45.46875, 76.625, 46.5, 1551 47.5, -30.390625, 42.90625, -76.8125, -82.25, 40.09375, 1552 -29.078125, 75, -10.859375, -23.296875, 48.875, -58.8125 1553 ], 1554 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1555 } 1556 } 1557 } 1558 }, 1559 { 1560 'name': 'where float16 4D tensors only broadcast condition 4D to 4D', 1561 'graph': { 1562 'inputs': { 1563 'inputCondition': { 1564 'data': [0, 165, 0, 90], 1565 'descriptor': {shape: [1, 2, 2, 1], dataType: 'uint8'} 1566 }, 1567 'inputTrueValue': { 1568 'data': [ 1569 70.25, 90, -1.53515625, -83.75, 29.59375, 1570 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1571 50.375, 46.5, 47.5, -21.953125, 42.90625, 1572 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1573 -10.859375, -23.296875, 30.84375, -58.8125 1574 ], 1575 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1576 }, 1577 'inputFalseValue': { 1578 'data': [ 1579 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1580 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1581 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1582 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1583 ], 1584 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1585 } 1586 }, 1587 'operators': [{ 1588 'name': 'where', 1589 'arguments': [ 1590 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1591 {'falseValue': 'inputFalseValue'} 1592 ], 1593 'outputs': 'whereOutput' 1594 }], 1595 'expectedOutputs': { 1596 'whereOutput': { 1597 'data': [ 1598 90.4375, 66.75, -39.8125, -83.75, 29.59375, -37.09375, 1599 -55.90625, 65.5625, 35.15625, -45.46875, 50.375, 46.5, 1600 -93.9375, -30.390625, 34.3125, -76.8125, 67, 40.09375, 1601 22.9375, 75, 18.875, -23.296875, 30.84375, -58.8125 1602 ], 1603 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1604 } 1605 } 1606 } 1607 }, 1608 { 1609 'name': 'where float16 4D tensors only broadcast trueValues 2D to 4D', 1610 'graph': { 1611 'inputs': { 1612 'inputCondition': { 1613 'data': [ 1614 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1615 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1616 ], 1617 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 1618 }, 1619 'inputTrueValue': { 1620 'data': 1621 [38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75], 1622 'descriptor': {shape: [2, 3], dataType: 'float16'} 1623 }, 1624 'inputFalseValue': { 1625 'data': [ 1626 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1627 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1628 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1629 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1630 ], 1631 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1632 } 1633 }, 1634 'operators': [{ 1635 'name': 'where', 1636 'arguments': [ 1637 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1638 {'falseValue': 'inputFalseValue'} 1639 ], 1640 'outputs': 'whereOutput' 1641 }], 1642 'expectedOutputs': { 1643 'whereOutput': { 1644 'data': [ 1645 38.78125, 66.75, -11.5390625, -21.6875, -18.609375, -75.75, 1646 38.78125, 65.5625, -11.5390625, -82.75, -18.609375, -75.75, 1647 38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75, 1648 38.78125, 18.203125, 18.875, -82.75, -18.609375, -75.4375 1649 ], 1650 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1651 } 1652 } 1653 } 1654 }, 1655 { 1656 'name': 'where float16 4D tensors only broadcast trueValues 4D to 4D', 1657 'graph': { 1658 'inputs': { 1659 'inputCondition': { 1660 'data': [ 1661 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1662 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1663 ], 1664 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 1665 }, 1666 'inputTrueValue': { 1667 'data': [-29.171875, 32.1875, -6.1484375, -24.828125], 1668 'descriptor': {shape: [2, 2, 1, 1], dataType: 'float16'} 1669 }, 1670 'inputFalseValue': { 1671 'data': [ 1672 90.4375, 66.75, -39.8125, -21.6875, -67.375, -46.46875, 1673 -55.90625, 65.5625, 35.15625, 11.9609375, 76.625, 60.75, 1674 -93.9375, -30.390625, 34.3125, 7.70703125, -82.25, 91.125, 1675 22.9375, 75, 18.875, 62.3125, 48.875, -75.4375 1676 ], 1677 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1678 } 1679 }, 1680 'operators': [{ 1681 'name': 'where', 1682 'arguments': [ 1683 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1684 {'falseValue': 'inputFalseValue'} 1685 ], 1686 'outputs': 'whereOutput' 1687 }], 1688 'expectedOutputs': { 1689 'whereOutput': { 1690 'data': [ 1691 -29.171875, 66.75, -29.171875, -21.6875, -29.171875, 1692 -29.171875, 32.1875, 65.5625, 32.1875, 32.1875, 1693 32.1875, 32.1875, -6.1484375, -6.1484375, -6.1484375, 1694 -6.1484375, -6.1484375, -6.1484375, -24.828125, -24.828125, 1695 18.875, -24.828125, -24.828125, -75.4375 1696 ], 1697 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1698 } 1699 } 1700 } 1701 }, 1702 { 1703 'name': 'where float16 4D tensors only broadcast falseValues 3D to 4D', 1704 'graph': { 1705 'inputs': { 1706 'inputCondition': { 1707 'data': [ 1708 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1709 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1710 ], 1711 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 1712 }, 1713 'inputTrueValue': { 1714 'data': [ 1715 70.25, 90, -1.53515625, -83.75, 29.59375, 1716 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1717 50.375, 46.5, 47.5, -21.953125, 42.90625, 1718 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1719 -10.859375, -23.296875, 30.84375, -58.8125 1720 ], 1721 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1722 }, 1723 'inputFalseValue': { 1724 'data': [-86.625, -67.75, -30.734375, -93.5], 1725 'descriptor': {shape: [2, 2, 1], dataType: 'float16'} 1726 } 1727 }, 1728 'operators': [{ 1729 'name': 'where', 1730 'arguments': [ 1731 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1732 {'falseValue': 'inputFalseValue'} 1733 ], 1734 'outputs': 'whereOutput' 1735 }], 1736 'expectedOutputs': { 1737 'whereOutput': { 1738 'data': [ 1739 70.25, -86.625, -1.53515625, -67.75, 29.59375, 1740 -37.09375, -6.6640625, -30.734375, -90.5, -45.46875, 1741 50.375, 46.5, 47.5, -21.953125, 42.90625, 1742 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1743 -30.734375, -23.296875, 30.84375, -93.5 1744 ], 1745 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1746 } 1747 } 1748 } 1749 }, 1750 { 1751 'name': 'where float16 4D tensors only broadcast falseValues 4D to 4D', 1752 'graph': { 1753 'inputs': { 1754 'inputCondition': { 1755 'data': [ 1756 241, 0, 85, 0, 227, 51, 202, 0, 104, 227, 129, 129, 1757 175, 134, 130, 140, 103, 46, 158, 17, 0, 41, 94, 0 1758 ], 1759 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 1760 }, 1761 'inputTrueValue': { 1762 'data': [ 1763 70.25, 90, -1.53515625, -83.75, 29.59375, 1764 -37.09375, -6.6640625, -83.125, -90.5, -45.46875, 1765 50.375, 46.5, 47.5, -21.953125, 42.90625, 1766 -76.8125, 67, 40.09375, -29.078125, -12.1875, 1767 -10.859375, -23.296875, 30.84375, -58.8125 1768 ], 1769 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1770 }, 1771 'inputFalseValue': { 1772 'data': [17.78125, -1.9892578125, -57.28125, -80, 66.875, -31.328125], 1773 'descriptor': {shape: [1, 2, 1, 3], dataType: 'float16'} 1774 } 1775 }, 1776 'operators': [{ 1777 'name': 'where', 1778 'arguments': [ 1779 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1780 {'falseValue': 'inputFalseValue'} 1781 ], 1782 'outputs': 'whereOutput' 1783 }], 1784 'expectedOutputs': { 1785 'whereOutput': { 1786 'data': [ 1787 70.25, -1.9892578125, -1.53515625, 17.78125, 1788 29.59375, -37.09375, -6.6640625, 66.875, 1789 -90.5, -45.46875, 50.375, 46.5, 1790 47.5, -21.953125, 42.90625, -76.8125, 1791 67, 40.09375, -29.078125, -12.1875, 1792 -31.328125, -23.296875, 30.84375, -31.328125 1793 ], 1794 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1795 } 1796 } 1797 } 1798 }, 1799 { 1800 'name': 'where float16 4D tensors all broadcast 4D', 1801 'graph': { 1802 'inputs': { 1803 'inputCondition': { 1804 'data': [58, 217], 1805 'descriptor': {shape: [2, 1, 1, 1], dataType: 'uint8'} 1806 }, 1807 'inputTrueValue': { 1808 'data': 1809 [38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75], 1810 'descriptor': {shape: [2, 3], dataType: 'float16'} 1811 }, 1812 'inputFalseValue': { 1813 'data': [-86.625, -67.75, -30.734375, -93.5], 1814 'descriptor': {shape: [2, 2, 1], dataType: 'float16'} 1815 } 1816 }, 1817 'operators': [{ 1818 'name': 'where', 1819 'arguments': [ 1820 {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, 1821 {'falseValue': 'inputFalseValue'} 1822 ], 1823 'outputs': 'whereOutput' 1824 }], 1825 'expectedOutputs': { 1826 'whereOutput': { 1827 'data': [ 1828 38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75, 1829 38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75, 1830 38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75, 1831 38.78125, 18.203125, -11.5390625, -82.75, -18.609375, -75.75 1832 ], 1833 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1834 } 1835 } 1836 } 1837 } 1838 ]; 1839 1840 webnn_conformance_test( 1841 whereTests, buildAndExecuteGraph, getWherePrecisionTolerance);