not_equal.https.any.js (35490B)
1 // META: title=test WebNN API element-wise notEqual 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://github.com/webmachinelearning/webnn/issues/375#issuecomment-2292466613 12 // Compare if the values of the two input tensors are not equal, element-wise. 13 // 14 // MLOperand notEqual(MLOperand a, MLOperand b); 15 16 const notEqualTests = [ 17 // float32 tests 18 { 19 'name': 'notEqual float32 0D scalar', 20 'graph': { 21 'inputs': { 22 'inputA': { 23 'data': [-0.6285496950149536], 24 'descriptor': {shape: [], dataType: 'float32'} 25 }, 26 'inputB': { 27 'data': [-4.4166412353515625], 28 'descriptor': {shape: [], dataType: 'float32'} 29 } 30 }, 31 'operators': [{ 32 'name': 'notEqual', 33 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 34 'outputs': 'output' 35 }], 36 'expectedOutputs': { 37 'output': {'data': [1], 'descriptor': {shape: [], dataType: 'uint8'}} 38 } 39 } 40 }, 41 { 42 'name': 'notEqual float32 1D constant tensors', 43 'graph': { 44 'inputs': { 45 'inputA': { 46 'data': [ 47 2.80570650100708, 5.588105201721191, 2.855226516723633, 48 4.996258735656738, 0.9727277755737305, -4.742599964141846, 49 2.80570650100708, 5.588105201721191, -5.107602119445801, 50 6.624142169952393, -2.3207247257232666, -7.053895950317383, 51 2.80570650100708, 5.588105201721191, 4.980423927307129, 52 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 53 2.80570650100708, 5.588105201721191, -6.245251178741455, 54 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 55 ], 56 'descriptor': {shape: [24], dataType: 'float32'}, 57 'constant': true 58 }, 59 'inputB': { 60 'data': [ 61 2.80570650100708, 5.588105201721191, -4.839719772338867, 62 4.996258735656738, 0.9727277755737305, -6.173707485198975, 63 2.80570650100708, 5.588105201721191, 7.767369747161865, 64 -4.308907985687256, -5.895479679107666, -8.53209114074707, 65 2.80570650100708, 5.588105201721191, 0.17833954095840454, 66 -4.479541778564453, 0.6819732189178467, -6.6875128746032715, 67 2.80570650100708, 5.588105201721191, -9.041799545288086, 68 -1.9728281497955322, -3.011512279510498, 3.6268343925476074 69 ], 70 'descriptor': {shape: [24], dataType: 'float32'}, 71 'constant': true 72 } 73 }, 74 'operators': [{ 75 'name': 'notEqual', 76 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 77 'outputs': 'output' 78 }], 79 'expectedOutputs': { 80 'output': { 81 'data': [ 82 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 83 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 84 ], 85 'descriptor': {shape: [24], dataType: 'uint8'} 86 } 87 } 88 } 89 }, 90 { 91 'name': 'notEqual float32 1D tensors', 92 'graph': { 93 'inputs': { 94 'inputA': { 95 'data': [ 96 2.80570650100708, 5.588105201721191, 2.855226516723633, 97 4.996258735656738, 0.9727277755737305, -4.742599964141846, 98 2.80570650100708, 5.588105201721191, -5.107602119445801, 99 6.624142169952393, -2.3207247257232666, -7.053895950317383, 100 2.80570650100708, 5.588105201721191, 4.980423927307129, 101 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 102 2.80570650100708, 5.588105201721191, -6.245251178741455, 103 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 104 ], 105 'descriptor': {shape: [24], dataType: 'float32'} 106 }, 107 'inputB': { 108 'data': [ 109 2.80570650100708, 5.588105201721191, -4.839719772338867, 110 4.996258735656738, 0.9727277755737305, -6.173707485198975, 111 2.80570650100708, 5.588105201721191, 7.767369747161865, 112 -4.308907985687256, -5.895479679107666, -8.53209114074707, 113 2.80570650100708, 5.588105201721191, 0.17833954095840454, 114 -4.479541778564453, 0.6819732189178467, -6.6875128746032715, 115 2.80570650100708, 5.588105201721191, -9.041799545288086, 116 -1.9728281497955322, -3.011512279510498, 3.6268343925476074 117 ], 118 'descriptor': {shape: [24], dataType: 'float32'} 119 } 120 }, 121 'operators': [{ 122 'name': 'notEqual', 123 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 124 'outputs': 'output' 125 }], 126 'expectedOutputs': { 127 'output': { 128 'data': [ 129 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 130 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 131 ], 132 'descriptor': {shape: [24], dataType: 'uint8'} 133 } 134 } 135 } 136 }, 137 { 138 'name': 'notEqual float32 2D tensors', 139 'graph': { 140 'inputs': { 141 'inputA': { 142 'data': [ 143 2.80570650100708, 5.588105201721191, 2.855226516723633, 144 4.996258735656738, 0.9727277755737305, -4.742599964141846, 145 2.80570650100708, 5.588105201721191, -5.107602119445801, 146 6.624142169952393, -2.3207247257232666, -7.053895950317383, 147 2.80570650100708, 5.588105201721191, 4.980423927307129, 148 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 149 2.80570650100708, 5.588105201721191, -6.245251178741455, 150 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 151 ], 152 'descriptor': {shape: [4, 6], dataType: 'float32'} 153 }, 154 'inputB': { 155 'data': [ 156 2.80570650100708, 5.588105201721191, -4.839719772338867, 157 4.996258735656738, 0.9727277755737305, -6.173707485198975, 158 2.80570650100708, 5.588105201721191, 7.767369747161865, 159 -4.308907985687256, -5.895479679107666, -8.53209114074707, 160 2.80570650100708, 5.588105201721191, 0.17833954095840454, 161 -4.479541778564453, 0.6819732189178467, -6.6875128746032715, 162 2.80570650100708, 5.588105201721191, -9.041799545288086, 163 -1.9728281497955322, -3.011512279510498, 3.6268343925476074 164 ], 165 'descriptor': {shape: [4, 6], dataType: 'float32'} 166 } 167 }, 168 'operators': [{ 169 'name': 'notEqual', 170 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 171 'outputs': 'output' 172 }], 173 'expectedOutputs': { 174 'output': { 175 'data': [ 176 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 177 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 178 ], 179 'descriptor': {shape: [4, 6], dataType: 'uint8'} 180 } 181 } 182 } 183 }, 184 { 185 'name': 'notEqual float32 3D tensors', 186 'graph': { 187 'inputs': { 188 'inputA': { 189 'data': [ 190 2.80570650100708, 5.588105201721191, 2.855226516723633, 191 4.996258735656738, 0.9727277755737305, -4.742599964141846, 192 2.80570650100708, 5.588105201721191, -5.107602119445801, 193 6.624142169952393, -2.3207247257232666, -7.053895950317383, 194 2.80570650100708, 5.588105201721191, 4.980423927307129, 195 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 196 2.80570650100708, 5.588105201721191, -6.245251178741455, 197 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 198 ], 199 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 200 }, 201 'inputB': { 202 'data': [ 203 2.80570650100708, 5.588105201721191, -4.839719772338867, 204 4.996258735656738, 0.9727277755737305, -6.173707485198975, 205 2.80570650100708, 5.588105201721191, 7.767369747161865, 206 -4.308907985687256, -5.895479679107666, -8.53209114074707, 207 2.80570650100708, 5.588105201721191, 0.17833954095840454, 208 -4.479541778564453, 0.6819732189178467, -6.6875128746032715, 209 2.80570650100708, 5.588105201721191, -9.041799545288086, 210 -1.9728281497955322, -3.011512279510498, 3.6268343925476074 211 ], 212 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 213 } 214 }, 215 'operators': [{ 216 'name': 'notEqual', 217 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 218 'outputs': 'output' 219 }], 220 'expectedOutputs': { 221 'output': { 222 'data': [ 223 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 224 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 225 ], 226 'descriptor': {shape: [2, 3, 4], dataType: 'uint8'} 227 } 228 } 229 } 230 }, 231 { 232 'name': 'notEqual float32 4D tensors', 233 'graph': { 234 'inputs': { 235 'inputA': { 236 'data': [ 237 2.80570650100708, 5.588105201721191, 2.855226516723633, 238 4.996258735656738, 0.9727277755737305, -4.742599964141846, 239 2.80570650100708, 5.588105201721191, -5.107602119445801, 240 6.624142169952393, -2.3207247257232666, -7.053895950317383, 241 2.80570650100708, 5.588105201721191, 4.980423927307129, 242 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 243 2.80570650100708, 5.588105201721191, -6.245251178741455, 244 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 245 ], 246 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 247 }, 248 'inputB': { 249 'data': [ 250 2.80570650100708, 5.588105201721191, -4.839719772338867, 251 4.996258735656738, 0.9727277755737305, -6.173707485198975, 252 2.80570650100708, 5.588105201721191, 7.767369747161865, 253 -4.308907985687256, -5.895479679107666, -8.53209114074707, 254 2.80570650100708, 5.588105201721191, 0.17833954095840454, 255 -4.479541778564453, 0.6819732189178467, -6.6875128746032715, 256 2.80570650100708, 5.588105201721191, -9.041799545288086, 257 -1.9728281497955322, -3.011512279510498, 3.6268343925476074 258 ], 259 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 260 } 261 }, 262 'operators': [{ 263 'name': 'notEqual', 264 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 265 'outputs': 'output' 266 }], 267 'expectedOutputs': { 268 'output': { 269 'data': [ 270 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 271 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 272 ], 273 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 274 } 275 } 276 } 277 }, 278 { 279 'name': 'notEqual float32 5D tensors', 280 'graph': { 281 'inputs': { 282 'inputA': { 283 'data': [ 284 2.80570650100708, 5.588105201721191, 2.855226516723633, 285 4.996258735656738, 0.9727277755737305, -4.742599964141846, 286 2.80570650100708, 5.588105201721191, -5.107602119445801, 287 6.624142169952393, -2.3207247257232666, -7.053895950317383, 288 2.80570650100708, 5.588105201721191, 4.980423927307129, 289 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 290 2.80570650100708, 5.588105201721191, -6.245251178741455, 291 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 292 ], 293 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 294 }, 295 'inputB': { 296 'data': [ 297 2.80570650100708, 5.588105201721191, -4.839719772338867, 298 4.996258735656738, 0.9727277755737305, -6.173707485198975, 299 2.80570650100708, 5.588105201721191, 7.767369747161865, 300 -4.308907985687256, -5.895479679107666, -8.53209114074707, 301 2.80570650100708, 5.588105201721191, 0.17833954095840454, 302 -4.479541778564453, 0.6819732189178467, -6.6875128746032715, 303 2.80570650100708, 5.588105201721191, -9.041799545288086, 304 -1.9728281497955322, -3.011512279510498, 3.6268343925476074 305 ], 306 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 307 } 308 }, 309 'operators': [{ 310 'name': 'notEqual', 311 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 312 'outputs': 'output' 313 }], 314 'expectedOutputs': { 315 'output': { 316 'data': [ 317 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 318 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 319 ], 320 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'uint8'} 321 } 322 } 323 } 324 }, 325 { 326 'name': 'notEqual float32 broadcast 0D to 4D', 327 'graph': { 328 'inputs': { 329 'inputA': { 330 'data': [2.80570650100708], 331 'descriptor': {shape: [], dataType: 'float32'} 332 }, 333 'inputB': { 334 'data': [ 335 2.80570650100708, 5.588105201721191, 2.855226516723633, 336 4.996258735656738, 0.9727277755737305, -4.742599964141846, 337 2.80570650100708, 5.588105201721191, -5.107602119445801, 338 6.624142169952393, -2.3207247257232666, -7.053895950317383, 339 2.80570650100708, 5.588105201721191, 4.980423927307129, 340 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 341 2.80570650100708, 5.588105201721191, -6.245251178741455, 342 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 343 ], 344 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 345 } 346 }, 347 'operators': [{ 348 'name': 'notEqual', 349 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 350 'outputs': 'output' 351 }], 352 'expectedOutputs': { 353 'output': { 354 'data': [ 355 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 356 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 357 ], 358 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 359 } 360 } 361 } 362 }, 363 { 364 'name': 'notEqual float32 broadcast 1D to 4D', 365 'graph': { 366 'inputs': { 367 'inputA': { 368 'data': [2.80570650100708], 369 'descriptor': {shape: [1], dataType: 'float32'} 370 }, 371 'inputB': { 372 'data': [ 373 2.80570650100708, 5.588105201721191, 2.855226516723633, 374 4.996258735656738, 0.9727277755737305, -4.742599964141846, 375 2.80570650100708, 5.588105201721191, -5.107602119445801, 376 6.624142169952393, -2.3207247257232666, -7.053895950317383, 377 2.80570650100708, 5.588105201721191, 4.980423927307129, 378 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 379 2.80570650100708, 5.588105201721191, -6.245251178741455, 380 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 381 ], 382 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 383 } 384 }, 385 'operators': [{ 386 'name': 'notEqual', 387 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 388 'outputs': 'output' 389 }], 390 'expectedOutputs': { 391 'output': { 392 'data': [ 393 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 394 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 395 ], 396 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 397 } 398 } 399 } 400 }, 401 { 402 'name': 'notEqual float32 broadcast 2D to 4D', 403 'graph': { 404 'inputs': { 405 'inputA': { 406 'data': [ 407 2.80570650100708, 5.588105201721191, 2.855226516723633, 408 4.996258735656738, 0.9727277755737305, -4.742599964141846, 409 2.80570650100708, 5.588105201721191, -5.107602119445801, 410 6.624142169952393, -2.3207247257232666, -7.053895950317383, 411 2.80570650100708, 5.588105201721191, 4.980423927307129, 412 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 413 2.80570650100708, 5.588105201721191, -6.245251178741455, 414 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 415 ], 416 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 417 }, 418 'inputB': { 419 'data': [ 420 2.80570650100708, 5.588105201721191, -4.9622955322265625, 421 -2.863192081451416, -3.011512279510498, 3.6268343925476074 422 ], 423 'descriptor': {shape: [2, 3], dataType: 'float32'} 424 } 425 }, 426 'operators': [{ 427 'name': 'notEqual', 428 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 429 'outputs': 'output' 430 }], 431 'expectedOutputs': { 432 'output': { 433 'data': [ 434 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 435 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 436 ], 437 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 438 } 439 } 440 } 441 }, 442 { 443 'name': 'notEqual float32 broadcast 3D to 4D', 444 'graph': { 445 'inputs': { 446 'inputA': { 447 'data': [ 448 2.80570650100708, 5.588105201721191, 2.855226516723633, 449 4.996258735656738, 0.9727277755737305, -4.742599964141846, 450 2.80570650100708, 5.588105201721191, -5.107602119445801, 451 6.624142169952393, -2.3207247257232666, -7.053895950317383, 452 2.80570650100708, 5.588105201721191, 4.980423927307129, 453 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 454 2.80570650100708, 5.588105201721191, -6.245251178741455, 455 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 456 ], 457 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 458 }, 459 'inputB': { 460 'data': [ 461 2.80570650100708, 5.588105201721191, -9.041799545288086, 462 3.6268343925476074 463 ], 464 'descriptor': {shape: [2, 2, 1], dataType: 'float32'} 465 } 466 }, 467 'operators': [{ 468 'name': 'notEqual', 469 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 470 'outputs': 'output' 471 }], 472 'expectedOutputs': { 473 'output': { 474 'data': [ 475 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 476 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 477 ], 478 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 479 } 480 } 481 } 482 }, 483 { 484 'name': 'notEqual float32 broadcast 4D to 4D', 485 'graph': { 486 'inputs': { 487 'inputA': { 488 'data': [2.80570650100708], 489 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 490 }, 491 'inputB': { 492 'data': [ 493 2.80570650100708, 5.588105201721191, 2.855226516723633, 494 4.996258735656738, 0.9727277755737305, -4.742599964141846, 495 2.80570650100708, 5.588105201721191, -5.107602119445801, 496 6.624142169952393, -2.3207247257232666, -7.053895950317383, 497 2.80570650100708, 5.588105201721191, 4.980423927307129, 498 -5.440841197967529, 1.1459590196609497, 7.774532794952393, 499 2.80570650100708, 5.588105201721191, -6.245251178741455, 500 -2.8490731716156006, -2.6951117515563965, 5.817563056945801 501 ], 502 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 503 } 504 }, 505 'operators': [{ 506 'name': 'notEqual', 507 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 508 'outputs': 'output' 509 }], 510 'expectedOutputs': { 511 'output': { 512 'data': [ 513 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 514 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 515 ], 516 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 517 } 518 } 519 } 520 }, 521 522 // float16 tests 523 { 524 'name': 'notEqual float16 0D scalar', 525 'graph': { 526 'inputs': { 527 'inputA': { 528 'data': [-0.62841796875], 529 'descriptor': {shape: [], dataType: 'float16'} 530 }, 531 'inputB': { 532 'data': [-4.41796875], 533 'descriptor': {shape: [], dataType: 'float16'} 534 } 535 }, 536 'operators': [{ 537 'name': 'notEqual', 538 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 539 'outputs': 'output' 540 }], 541 'expectedOutputs': { 542 'output': {'data': [1], 'descriptor': {shape: [], dataType: 'uint8'}} 543 } 544 } 545 }, 546 { 547 'name': 'notEqual float16 1D constant tensors', 548 'graph': { 549 'inputs': { 550 'inputA': { 551 'data': [ 552 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 553 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 554 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 555 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 556 -6.24609375, -2.849609375, -2.6953125, 5.81640625 557 ], 558 'descriptor': {shape: [24], dataType: 'float16'}, 559 'constant': true 560 }, 561 'inputB': { 562 'data': [ 563 2.806640625, 5.58984375, -4.83984375, 4.99609375, 564 0.97265625, -6.171875, 2.806640625, 5.58984375, 565 7.765625, -4.30859375, -5.89453125, -8.53125, 566 2.806640625, 5.58984375, 0.1783447265625, -4.48046875, 567 0.68212890625, -6.6875, 2.806640625, 5.58984375, 568 -9.0390625, -1.97265625, -3.01171875, 3.626953125 569 ], 570 'descriptor': {shape: [24], dataType: 'float16'}, 571 'constant': true 572 } 573 }, 574 'operators': [{ 575 'name': 'notEqual', 576 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 577 'outputs': 'output' 578 }], 579 'expectedOutputs': { 580 'output': { 581 'data': [ 582 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 583 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 584 ], 585 'descriptor': {shape: [24], dataType: 'uint8'} 586 } 587 } 588 } 589 }, 590 { 591 'name': 'notEqual float16 1D tensors', 592 'graph': { 593 'inputs': { 594 'inputA': { 595 'data': [ 596 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 597 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 598 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 599 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 600 -6.24609375, -2.849609375, -2.6953125, 5.81640625 601 ], 602 'descriptor': {shape: [24], dataType: 'float16'} 603 }, 604 'inputB': { 605 'data': [ 606 2.806640625, 5.58984375, -4.83984375, 4.99609375, 607 0.97265625, -6.171875, 2.806640625, 5.58984375, 608 7.765625, -4.30859375, -5.89453125, -8.53125, 609 2.806640625, 5.58984375, 0.1783447265625, -4.48046875, 610 0.68212890625, -6.6875, 2.806640625, 5.58984375, 611 -9.0390625, -1.97265625, -3.01171875, 3.626953125 612 ], 613 'descriptor': {shape: [24], dataType: 'float16'} 614 } 615 }, 616 'operators': [{ 617 'name': 'notEqual', 618 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 619 'outputs': 'output' 620 }], 621 'expectedOutputs': { 622 'output': { 623 'data': [ 624 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 625 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 626 ], 627 'descriptor': {shape: [24], dataType: 'uint8'} 628 } 629 } 630 } 631 }, 632 { 633 'name': 'notEqual float16 2D tensors', 634 'graph': { 635 'inputs': { 636 'inputA': { 637 'data': [ 638 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 639 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 640 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 641 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 642 -6.24609375, -2.849609375, -2.6953125, 5.81640625 643 ], 644 'descriptor': {shape: [4, 6], dataType: 'float16'} 645 }, 646 'inputB': { 647 'data': [ 648 2.806640625, 5.58984375, -4.83984375, 4.99609375, 649 0.97265625, -6.171875, 2.806640625, 5.58984375, 650 7.765625, -4.30859375, -5.89453125, -8.53125, 651 2.806640625, 5.58984375, 0.1783447265625, -4.48046875, 652 0.68212890625, -6.6875, 2.806640625, 5.58984375, 653 -9.0390625, -1.97265625, -3.01171875, 3.626953125 654 ], 655 'descriptor': {shape: [4, 6], dataType: 'float16'} 656 } 657 }, 658 'operators': [{ 659 'name': 'notEqual', 660 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 661 'outputs': 'output' 662 }], 663 'expectedOutputs': { 664 'output': { 665 'data': [ 666 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 667 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 668 ], 669 'descriptor': {shape: [4, 6], dataType: 'uint8'} 670 } 671 } 672 } 673 }, 674 { 675 'name': 'notEqual float16 3D tensors', 676 'graph': { 677 'inputs': { 678 'inputA': { 679 'data': [ 680 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 681 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 682 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 683 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 684 -6.24609375, -2.849609375, -2.6953125, 5.81640625 685 ], 686 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 687 }, 688 'inputB': { 689 'data': [ 690 2.806640625, 5.58984375, -4.83984375, 4.99609375, 691 0.97265625, -6.171875, 2.806640625, 5.58984375, 692 7.765625, -4.30859375, -5.89453125, -8.53125, 693 2.806640625, 5.58984375, 0.1783447265625, -4.48046875, 694 0.68212890625, -6.6875, 2.806640625, 5.58984375, 695 -9.0390625, -1.97265625, -3.01171875, 3.626953125 696 ], 697 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 698 } 699 }, 700 'operators': [{ 701 'name': 'notEqual', 702 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 703 'outputs': 'output' 704 }], 705 'expectedOutputs': { 706 'output': { 707 'data': [ 708 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 709 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 710 ], 711 'descriptor': {shape: [2, 3, 4], dataType: 'uint8'} 712 } 713 } 714 } 715 }, 716 { 717 'name': 'notEqual float16 4D tensors', 718 'graph': { 719 'inputs': { 720 'inputA': { 721 'data': [ 722 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 723 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 724 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 725 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 726 -6.24609375, -2.849609375, -2.6953125, 5.81640625 727 ], 728 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 729 }, 730 'inputB': { 731 'data': [ 732 2.806640625, 5.58984375, -4.83984375, 4.99609375, 733 0.97265625, -6.171875, 2.806640625, 5.58984375, 734 7.765625, -4.30859375, -5.89453125, -8.53125, 735 2.806640625, 5.58984375, 0.1783447265625, -4.48046875, 736 0.68212890625, -6.6875, 2.806640625, 5.58984375, 737 -9.0390625, -1.97265625, -3.01171875, 3.626953125 738 ], 739 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 740 } 741 }, 742 'operators': [{ 743 'name': 'notEqual', 744 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 745 'outputs': 'output' 746 }], 747 'expectedOutputs': { 748 'output': { 749 'data': [ 750 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 751 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 752 ], 753 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 754 } 755 } 756 } 757 }, 758 { 759 'name': 'notEqual float16 5D tensors', 760 'graph': { 761 'inputs': { 762 'inputA': { 763 'data': [ 764 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 765 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 766 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 767 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 768 -6.24609375, -2.849609375, -2.6953125, 5.81640625 769 ], 770 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 771 }, 772 'inputB': { 773 'data': [ 774 2.806640625, 5.58984375, -4.83984375, 4.99609375, 775 0.97265625, -6.171875, 2.806640625, 5.58984375, 776 7.765625, -4.30859375, -5.89453125, -8.53125, 777 2.806640625, 5.58984375, 0.1783447265625, -4.48046875, 778 0.68212890625, -6.6875, 2.806640625, 5.58984375, 779 -9.0390625, -1.97265625, -3.01171875, 3.626953125 780 ], 781 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 782 } 783 }, 784 'operators': [{ 785 'name': 'notEqual', 786 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 787 'outputs': 'output' 788 }], 789 'expectedOutputs': { 790 'output': { 791 'data': [ 792 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 793 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 794 ], 795 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'uint8'} 796 } 797 } 798 } 799 }, 800 { 801 'name': 'notEqual float16 broadcast 0D to 4D', 802 'graph': { 803 'inputs': { 804 'inputA': { 805 'data': [2.806640625], 806 'descriptor': {shape: [], dataType: 'float16'} 807 }, 808 'inputB': { 809 'data': [ 810 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 811 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 812 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 813 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 814 -6.24609375, -2.849609375, -2.6953125, 5.81640625 815 ], 816 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 817 } 818 }, 819 'operators': [{ 820 'name': 'notEqual', 821 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 822 'outputs': 'output' 823 }], 824 'expectedOutputs': { 825 'output': { 826 'data': [ 827 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 828 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 829 ], 830 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 831 } 832 } 833 } 834 }, 835 { 836 'name': 'notEqual float16 broadcast 1D to 4D', 837 'graph': { 838 'inputs': { 839 'inputA': { 840 'data': [2.806640625], 841 'descriptor': {shape: [1], dataType: 'float16'} 842 }, 843 'inputB': { 844 'data': [ 845 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 846 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 847 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 848 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 849 -6.24609375, -2.849609375, -2.6953125, 5.81640625 850 ], 851 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 852 } 853 }, 854 'operators': [{ 855 'name': 'notEqual', 856 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 857 'outputs': 'output' 858 }], 859 'expectedOutputs': { 860 'output': { 861 'data': [ 862 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 863 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 864 ], 865 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 866 } 867 } 868 } 869 }, 870 { 871 'name': 'notEqual float16 broadcast 2D to 4D', 872 'graph': { 873 'inputs': { 874 'inputA': { 875 'data': [ 876 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 877 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 878 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 879 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 880 -6.24609375, -2.849609375, -2.6953125, 5.81640625 881 ], 882 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 883 }, 884 'inputB': { 885 'data': [ 886 2.806640625, 5.58984375, -4.9609375, -2.86328125, -3.01171875, 887 3.626953125 888 ], 889 'descriptor': {shape: [2, 3], dataType: 'float16'} 890 } 891 }, 892 'operators': [{ 893 'name': 'notEqual', 894 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 895 'outputs': 'output' 896 }], 897 'expectedOutputs': { 898 'output': { 899 'data': [ 900 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 901 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 902 ], 903 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 904 } 905 } 906 } 907 }, 908 { 909 'name': 'notEqual float16 broadcast 3D to 4D', 910 'graph': { 911 'inputs': { 912 'inputA': { 913 'data': [ 914 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 915 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 916 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 917 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 918 -6.24609375, -2.849609375, -2.6953125, 5.81640625 919 ], 920 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 921 }, 922 'inputB': { 923 'data': [2.806640625, 5.58984375, -9.0390625, 3.626953125], 924 'descriptor': {shape: [2, 2, 1], dataType: 'float16'} 925 } 926 }, 927 'operators': [{ 928 'name': 'notEqual', 929 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 930 'outputs': 'output' 931 }], 932 'expectedOutputs': { 933 'output': { 934 'data': [ 935 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 936 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 937 ], 938 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 939 } 940 } 941 } 942 }, 943 { 944 'name': 'notEqual float16 broadcast 4D to 4D', 945 'graph': { 946 'inputs': { 947 'inputA': { 948 'data': [2.806640625], 949 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} 950 }, 951 'inputB': { 952 'data': [ 953 2.806640625, 5.58984375, 2.85546875, 4.99609375, 0.97265625, 954 -4.7421875, 2.806640625, 5.58984375, -5.109375, 6.625, 955 -2.3203125, -7.0546875, 2.806640625, 5.58984375, 4.98046875, 956 -5.44140625, 1.1455078125, 7.7734375, 2.806640625, 5.58984375, 957 -6.24609375, -2.849609375, -2.6953125, 5.81640625 958 ], 959 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 960 } 961 }, 962 'operators': [{ 963 'name': 'notEqual', 964 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], 965 'outputs': 'output' 966 }], 967 'expectedOutputs': { 968 'output': { 969 'data': [ 970 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 971 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 972 ], 973 'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'} 974 } 975 } 976 } 977 } 978 ]; 979 980 webnn_conformance_test( 981 notEqualTests, buildAndExecuteGraph, getZeroULPTolerance);