qdq_subgraph.https.any.js (116198B)
1 // META: title=test WebNN `dequantization -> operators -> quantization` subgraph 2 // META: global=window,worker 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 const subgraphTests = [ 12 { 13 'name': 'quantized conv2d', 14 'graph': { 15 'inputs': { 16 'input': { 17 'data': [0.05605664849281311, 0.7114229798316956, 0.6529743671417236], 18 'descriptor': {shape: [1, 1, 1, 3], dataType: 'float32'}, 19 'constant': false 20 }, 21 'inputScale': { 22 'data': [0.003921568859368563], 23 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 24 'constant': true 25 }, 26 'inputZeroPoint': { 27 'data': [-128], 28 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 29 'constant': true 30 }, 31 'filter': { 32 'data': [2, 3, 4], 33 'descriptor': {shape: [1, 1, 1, 3], dataType: 'int8'}, 34 'constant': true 35 }, 36 'filterScale': { 37 'data': [0.023458752938762234], 38 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 39 'constant': true 40 }, 41 'filterZeroPoint': { 42 'data': [0], 43 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 44 'constant': true 45 }, 46 'bias': { 47 'data': [1], 48 'descriptor': {shape: [1], dataType: 'int32'}, 49 'constant': true 50 }, 51 'biasScale': { 52 'data': [0.000091995115004270], 53 'descriptor': {shape: [1], dataType: 'float32'}, 54 'constant': true 55 }, 56 'biasZeroPoint': { 57 'data': [0], 58 'descriptor': {shape: [1], dataType: 'int32'}, 59 'constant': true 60 }, 61 'outputScale': { 62 'data': [0.003921568859368563], 63 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 64 'constant': true 65 }, 66 'outputZeroPoint': { 67 'data': [0], 68 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 69 'constant': true 70 }, 71 }, 72 'operators': [ 73 { 74 'name': 'quantizeLinear', 75 'arguments': [ 76 {'input': 'input'}, 77 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 78 ], 79 'outputs': 'quantizedInput' 80 }, 81 { 82 'name': 'dequantizeLinear', 83 'arguments': [ 84 {'input': 'quantizedInput'}, 85 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 86 ], 87 'outputs': 'dequantizedInput' 88 }, 89 { 90 'name': 'dequantizeLinear', 91 'arguments': [ 92 {'input': 'filter'}, 93 {'scale': 'filterScale', 'zeroPoint': 'filterZeroPoint'} 94 ], 95 'outputs': 'dequantizedFilter' 96 }, 97 { 98 'name': 'dequantizeLinear', 99 'arguments': [ 100 {'input': 'bias'}, 101 {'scale': 'biasScale', 'zeroPoint': 'biasZeroPoint'} 102 ], 103 'outputs': 'dequantizedBias' 104 }, 105 { 106 'name': 'conv2d', 107 'arguments': [ 108 {'input': 'dequantizedInput'}, {'filter': 'dequantizedFilter'}, { 109 'options': { 110 'inputLayout': 'nhwc', 111 'bias': 'dequantizedBias', 112 'filterLayout': 'ohwi' 113 } 114 } 115 ], 116 'outputs': 'conv2dOutput' 117 }, 118 { 119 'name': 'quantizeLinear', 120 'arguments': [ 121 {'input': 'conv2dOutput'}, 122 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 123 ], 124 'outputs': 'quantizedConv2dOutput' 125 }, 126 { 127 'name': 'dequantizeLinear', 128 'arguments': [ 129 {'input': 'quantizedConv2dOutput'}, 130 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 131 ], 132 'outputs': 'output' 133 } 134 ], 135 'expectedOutputs': { 136 'output': { 137 'data': [0.11372549831867218], 138 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 139 } 140 } 141 } 142 }, 143 { 144 'name': 'dequantizeLinear -> conv2d -> clamp -> quantizeLinear', 145 'graph': { 146 'inputs': { 147 'input': { 148 'data': [0.05605664849281311, 0.7114229798316956, 0.6529743671417236], 149 'descriptor': {shape: [1, 1, 1, 3], dataType: 'float32'}, 150 'constant': false 151 }, 152 'inputScale': { 153 'data': [0.003921568859368563], 154 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 155 'constant': true 156 }, 157 'inputZeroPoint': { 158 'data': [-128], 159 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 160 'constant': true 161 }, 162 'filter': { 163 'data': [2, 3, 4], 164 'descriptor': {shape: [1, 1, 1, 3], dataType: 'int8'}, 165 'constant': true 166 }, 167 'filterScale': { 168 'data': [0.023458752938762234], 169 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 170 'constant': true 171 }, 172 'filterZeroPoint': { 173 'data': [0], 174 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 175 'constant': true 176 }, 177 'bias': { 178 'data': [1], 179 'descriptor': {shape: [1], dataType: 'int32'}, 180 'constant': true 181 }, 182 'biasScale': { 183 'data': [0.000091995115004270], 184 'descriptor': {shape: [1], dataType: 'float32'}, 185 'constant': true 186 }, 187 'biasZeroPoint': { 188 'data': [0], 189 'descriptor': {shape: [1], dataType: 'int32'}, 190 'constant': true 191 }, 192 'outputScale': { 193 'data': [0.003921568859368563], 194 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 195 'constant': true 196 }, 197 'outputZeroPoint': { 198 'data': [0], 199 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 200 'constant': true 201 }, 202 }, 203 'operators': [ 204 { 205 'name': 'quantizeLinear', 206 'arguments': [ 207 {'input': 'input'}, 208 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 209 ], 210 'outputs': 'quantizedInput' 211 }, 212 { 213 'name': 'dequantizeLinear', 214 'arguments': [ 215 {'input': 'quantizedInput'}, 216 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 217 ], 218 'outputs': 'dequantizedInput' 219 }, 220 { 221 'name': 'dequantizeLinear', 222 'arguments': [ 223 {'input': 'filter'}, 224 {'scale': 'filterScale', 'zeroPoint': 'filterZeroPoint'} 225 ], 226 'outputs': 'dequantizedFilter' 227 }, 228 { 229 'name': 'dequantizeLinear', 230 'arguments': [ 231 {'input': 'bias'}, 232 {'scale': 'biasScale', 'zeroPoint': 'biasZeroPoint'} 233 ], 234 'outputs': 'dequantizedBias' 235 }, 236 { 237 'name': 'conv2d', 238 'arguments': [ 239 {'input': 'dequantizedInput'}, {'filter': 'dequantizedFilter'}, { 240 'options': { 241 'inputLayout': 'nhwc', 242 'bias': 'dequantizedBias', 243 'filterLayout': 'ohwi' 244 } 245 } 246 ], 247 'outputs': 'conv2dOutput' 248 }, 249 { 250 'name': 'clamp', 251 'arguments': [ 252 {'input': 'conv2dOutput'}, 253 {'options': {'minValue': 0, 'maxValue': 6}} 254 ], 255 'outputs': 'clampOutput' 256 }, 257 { 258 'name': 'quantizeLinear', 259 'arguments': [ 260 {'input': 'clampOutput'}, 261 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 262 ], 263 'outputs': 'quantizedClampOutput' 264 }, 265 { 266 'name': 'dequantizeLinear', 267 'arguments': [ 268 {'input': 'quantizedClampOutput'}, 269 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 270 ], 271 'outputs': 'output' 272 } 273 ], 274 'expectedOutputs': { 275 'output': { 276 'data': [0.11372549831867218], 277 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 278 } 279 } 280 } 281 }, 282 { 283 'name': 'dequantizeLinear -> conv2d -> relu -> quantizeLinear', 284 'graph': { 285 'inputs': { 286 'input': { 287 'data': [0.05605664849281311, 0.7114229798316956, 0.6529743671417236], 288 'descriptor': {shape: [1, 1, 1, 3], dataType: 'float32'}, 289 'constant': false 290 }, 291 'inputScale': { 292 'data': [0.003921568859368563], 293 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 294 'constant': true 295 }, 296 'inputZeroPoint': { 297 'data': [-128], 298 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 299 'constant': true 300 }, 301 'filter': { 302 'data': [2, 3, 4], 303 'descriptor': {shape: [1, 1, 1, 3], dataType: 'int8'}, 304 'constant': true 305 }, 306 'filterScale': { 307 'data': [0.7114229798316956], 308 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 309 'constant': true 310 }, 311 'filterZeroPoint': { 312 'data': [-128], 313 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 314 'constant': true 315 }, 316 'bias': { 317 'data': [1], 318 'descriptor': {shape: [1], dataType: 'int32'}, 319 'constant': true 320 }, 321 'biasScale': { 322 'data': [0.000091995115004270], 323 'descriptor': {shape: [1], dataType: 'float32'}, 324 'constant': true 325 }, 326 'biasZeroPoint': { 327 'data': [0], 328 'descriptor': {shape: [1], dataType: 'int32'}, 329 'constant': true 330 }, 331 'outputScale': { 332 'data': [0.003921568859368563], 333 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 334 'constant': true 335 }, 336 'outputZeroPoint': { 337 'data': [0], 338 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 339 'constant': true 340 }, 341 }, 342 'operators': [ 343 { 344 'name': 'quantizeLinear', 345 'arguments': [ 346 {'input': 'input'}, 347 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 348 ], 349 'outputs': 'quantizedInput' 350 }, 351 { 352 'name': 'dequantizeLinear', 353 'arguments': [ 354 {'input': 'quantizedInput'}, 355 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 356 ], 357 'outputs': 'dequantizedInput' 358 }, 359 { 360 'name': 'dequantizeLinear', 361 'arguments': [ 362 {'input': 'filter'}, 363 {'scale': 'filterScale', 'zeroPoint': 'filterZeroPoint'} 364 ], 365 'outputs': 'dequantizedFilter' 366 }, 367 { 368 'name': 'dequantizeLinear', 369 'arguments': [ 370 {'input': 'bias'}, 371 {'scale': 'biasScale', 'zeroPoint': 'biasZeroPoint'} 372 ], 373 'outputs': 'dequantizedBias' 374 }, 375 { 376 'name': 'conv2d', 377 'arguments': [ 378 {'input': 'dequantizedInput'}, {'filter': 'dequantizedFilter'}, { 379 'options': { 380 'inputLayout': 'nhwc', 381 'bias': 'dequantizedBias', 382 'filterLayout': 'ohwi' 383 } 384 } 385 ], 386 'outputs': 'conv2dOutput' 387 }, 388 { 389 'name': 'relu', 390 'arguments': [ 391 {'input': 'conv2dOutput'} 392 ], 393 'outputs': 'reluOutput' 394 }, 395 { 396 'name': 'quantizeLinear', 397 'arguments': [ 398 {'input': 'reluOutput'}, 399 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 400 ], 401 'outputs': 'quantizedReluOutput' 402 }, 403 { 404 'name': 'dequantizeLinear', 405 'arguments': [ 406 {'input': 'quantizedReluOutput'}, 407 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 408 ], 409 'outputs': 'output' 410 } 411 ], 412 'expectedOutputs': { 413 'output': { 414 'data': [0.49803924560546875], 415 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 416 } 417 } 418 } 419 }, 420 { 421 'name': 'quantized convTranspose2d', 422 'graph': { 423 'inputs': { 424 'input': { 425 'data': [ 426 0.05605664849281311, 0.7114229798316956, 427 0.6529743671417236, 0.7114229798316956, 428 ], 429 'descriptor': {shape: [1, 2, 2, 1], dataType: 'float32'}, 430 'constant': false 431 }, 432 'inputScale': { 433 'data': [0.003921568859368563], 434 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 435 'constant': true 436 }, 437 'inputZeroPoint': { 438 'data': [-128], 439 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 440 'constant': true 441 }, 442 'filter': { 443 'data': [ 444 2, 3, 4, 5, 445 ], 446 'descriptor': {shape: [1, 2, 2, 1], dataType: 'int8'}, 447 'constant': true 448 }, 449 'filterScale': { 450 'data': [0.023458752938762234], 451 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 452 'constant': true 453 }, 454 'filterZeroPoint': { 455 'data': [0], 456 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 457 'constant': true 458 }, 459 'bias': { 460 'data': [2], 461 'descriptor': {shape: [1], dataType: 'int32'}, 462 'constant': true 463 }, 464 'biasScale': { 465 'data': [0.000091995115004270], 466 'descriptor': {shape: [1], dataType: 'float32'}, 467 'constant': true 468 }, 469 'biasZeroPoint': { 470 'data': [0], 471 'descriptor': {shape: [1], dataType: 'int32'}, 472 'constant': true 473 }, 474 'outputScale': { 475 'data': [0.003921568859368563], 476 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 477 'constant': true 478 }, 479 'outputZeroPoint': { 480 'data': [0], 481 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 482 'constant': true 483 }, 484 }, 485 'operators': [ 486 { 487 'name': 'quantizeLinear', 488 'arguments': [ 489 {'input': 'input'}, 490 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 491 ], 492 'outputs': 'quantizedInput' 493 }, 494 { 495 'name': 'dequantizeLinear', 496 'arguments': [ 497 {'input': 'quantizedInput'}, 498 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 499 ], 500 'outputs': 'dequantizedInput' 501 }, 502 { 503 'name': 'dequantizeLinear', 504 'arguments': [ 505 {'input': 'filter'}, 506 {'scale': 'filterScale', 'zeroPoint': 'filterZeroPoint'} 507 ], 508 'outputs': 'dequantizedFilter' 509 }, 510 { 511 'name': 'dequantizeLinear', 512 'arguments': [ 513 {'input': 'bias'}, 514 {'scale': 'biasScale', 'zeroPoint': 'biasZeroPoint'} 515 ], 516 'outputs': 'dequantizedBias' 517 }, 518 { 519 'name': 'convTranspose2d', 520 'arguments': [ 521 {'input': 'dequantizedInput'}, {'filter': 'dequantizedFilter'}, { 522 'options': { 523 'inputLayout': 'nhwc', 524 'bias': 'dequantizedBias', 525 'filterLayout': 'ohwi' 526 } 527 } 528 ], 529 'outputs': 'convTranspose2dOutput' 530 }, 531 { 532 'name': 'quantizeLinear', 533 'arguments': [ 534 {'input': 'convTranspose2dOutput'}, 535 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 536 ], 537 'outputs': 'quantizedConvTranspose2dOutput' 538 }, 539 { 540 'name': 'dequantizeLinear', 541 'arguments': [ 542 {'input': 'quantizedConvTranspose2dOutput'}, 543 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 544 ], 545 'outputs': 'output' 546 } 547 ], 548 'expectedOutputs': { 549 'output': { 550 'data': [ 551 0.003921568859368563, 0.03921568766236305, 0.05098039656877518, 552 0.03529411926865578, 0.15294118225574493, 0.13333334028720856, 553 0.062745101749897, 0.14509804546833038, 0.08235294371843338, 554 ], 555 'descriptor': {shape: [1, 3, 3, 1], dataType: 'float32'} 556 } 557 } 558 } 559 }, 560 { 561 'name': 'quantized element-wise binary add', 562 'graph': { 563 'inputs': { 564 'inputA': { 565 'data': [ 566 0.41167140007019043, 0.0479511022567749, 0.33355462551116943, 567 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, 568 ], 569 'descriptor': {shape: [1, 1, 2, 3], dataType: 'float32'}, 570 'constant': false 571 }, 572 'inputAScale': { 573 'data': [0.003921568859368563], 574 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 575 'constant': true 576 }, 577 'inputAZeroPoint': { 578 'data': [-128], 579 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 580 'constant': true 581 }, 582 'inputB': { 583 'data': [ 584 2, 7, 8, 11, 5, 23, 585 ], 586 'descriptor': {shape: [1, 1, 2, 3], dataType: 'int8'}, 587 'constant': true 588 }, 589 'inputBScale': { 590 'data': [0.003921568859368563], 591 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 592 'constant': true 593 }, 594 'inputBZeroPoint': { 595 'data': [-128], 596 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 597 'constant': true 598 }, 599 'outputScale': { 600 'data': [0.003921568859368563], 601 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 602 'constant': true 603 }, 604 'outputZeroPoint': { 605 'data': [-128], 606 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 607 'constant': true 608 }, 609 }, 610 'operators': [ 611 { 612 'name': 'quantizeLinear', 613 'arguments': [ 614 {'input': 'inputA'}, 615 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 616 ], 617 'outputs': 'quantizedInputA' 618 }, 619 { 620 'name': 'dequantizeLinear', 621 'arguments': [ 622 {'input': 'quantizedInputA'}, 623 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 624 ], 625 'outputs': 'dequantizedInputA' 626 }, 627 { 628 'name': 'dequantizeLinear', 629 'arguments': [ 630 {'input': 'inputB'}, 631 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 632 ], 633 'outputs': 'dequantizedInputB' 634 }, 635 { 636 'name': 'add', 637 'arguments': [ 638 {'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'} 639 ], 640 'outputs': 'addOutput' 641 }, 642 { 643 'name': 'quantizeLinear', 644 'arguments': [ 645 {'input': 'addOutput'}, 646 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 647 ], 648 'outputs': 'quantizedAddOutput' 649 }, 650 { 651 'name': 'dequantizeLinear', 652 'arguments': [ 653 {'input': 'quantizedAddOutput'}, 654 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 655 ], 656 'outputs': 'output' 657 } 658 ], 659 'expectedOutputs': { 660 'output': { 661 'data': [ 662 0.9215686917304993, 0.5764706134796143, 0.8666667342185974, 663 0.7450980544090271, 0.9333333969116211, 0.6705882549285889, 664 ], 665 'descriptor': {shape: [1, 1, 2, 3], dataType: 'float32'} 666 } 667 } 668 } 669 }, 670 { 671 'name': 'quantized conv2d with padding', 672 'graph': { 673 'inputs': { 674 'input': { 675 'data': [ 676 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, 677 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, 678 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, 679 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, 680 0.4272463321685791, 0.535800576210022, 0.5910806059837341, 681 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, 682 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, 683 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, 684 0.21529443562030792 685 ], 686 'descriptor': {shape: [1, 5, 5, 1], dataType: 'float32'}, 687 'constant': false 688 }, 689 'inputScale': { 690 'data': [0.003921568859368563], 691 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 692 'constant': true 693 }, 694 'inputZeroPoint': { 695 'data': [-128], 696 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 697 'constant': true 698 }, 699 'filter': { 700 'data': [2, 3, 4, 5, 6, 7, 8, 9, 3], 701 'descriptor': {shape: [1, 3, 3, 1], dataType: 'int8'}, 702 'constant': true 703 }, 704 'filterScale': { 705 'data': [0.023458752938762234], 706 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 707 'constant': true 708 }, 709 'filterZeroPoint': { 710 'data': [0], 711 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 712 'constant': true 713 }, 714 'bias': { 715 'data': [1], 716 'descriptor': {shape: [1], dataType: 'int32'}, 717 'constant': true 718 }, 719 'biasScale': { 720 'data': [0.000091995115004270], 721 'descriptor': {shape: [1], dataType: 'float32'}, 722 'constant': true 723 }, 724 'biasZeroPoint': { 725 'data': [0], 726 'descriptor': {shape: [1], dataType: 'int32'}, 727 'constant': true 728 }, 729 'outputScale': { 730 'data': [0.003921568859368563], 731 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 732 'constant': true 733 }, 734 'outputZeroPoint': { 735 'data': [0], 736 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 737 'constant': true 738 }, 739 }, 740 'operators': [ 741 { 742 'name': 'quantizeLinear', 743 'arguments': [ 744 {'input': 'input'}, 745 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 746 ], 747 'outputs': 'quantizedInput' 748 }, 749 { 750 'name': 'dequantizeLinear', 751 'arguments': [ 752 {'input': 'quantizedInput'}, 753 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 754 ], 755 'outputs': 'dequantizedInput' 756 }, 757 { 758 'name': 'dequantizeLinear', 759 'arguments': [ 760 {'input': 'filter'}, 761 {'scale': 'filterScale', 'zeroPoint': 'filterZeroPoint'} 762 ], 763 'outputs': 'dequantizedFilter' 764 }, 765 { 766 'name': 'dequantizeLinear', 767 'arguments': [ 768 {'input': 'bias'}, 769 {'scale': 'biasScale', 'zeroPoint': 'biasZeroPoint'} 770 ], 771 'outputs': 'dequantizedBias' 772 }, 773 { 774 'name': 'conv2d', 775 'arguments': [ 776 {'input': 'dequantizedInput'}, {'filter': 'dequantizedFilter'}, { 777 'options': { 778 'inputLayout': 'nhwc', 779 'bias': 'dequantizedBias', 780 'filterLayout': 'ohwi', 781 'padding': [2, 1, 2, 1] 782 } 783 } 784 ], 785 'outputs': 'conv2dOutput' 786 }, 787 { 788 'name': 'quantizeLinear', 789 'arguments': [ 790 {'input': 'conv2dOutput'}, 791 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 792 ], 793 'outputs': 'quantizedConv2dOutput' 794 }, 795 { 796 'name': 'dequantizeLinear', 797 'arguments': [ 798 {'input': 'quantizedConv2dOutput'}, 799 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 800 ], 801 'outputs': 'output' 802 } 803 ], 804 'expectedOutputs': { 805 'output': { 806 'data': [ 807 0.04313725605607033, 0.19215688109397888, 0.30980393290519714, 808 0.2352941334247589, 0.20784315466880798, 0.29411765933036804, 809 0.125490203499794, 0.35686275362968445, 0.43529415130615234, 810 0.3764706254005432, 0.33725491166114807, 0.2980392277240753, 811 0.14509804546833038, 0.38431376218795776, 0.3764706254005432, 812 0.38823533058166504, 0.45098042488098145, 0.38431376218795776, 813 0.12156863510608673, 0.250980406999588, 0.34117648005485535, 814 0.3333333432674408, 0.41960787773132324, 0.4549019932746887, 815 0.09019608050584793, 0.16862745583057404, 0.25882354378700256, 816 0.4274510145187378, 0.49803924560546875, 0.3803921937942505, 817 0.03921568766236305, 0.09019608050584793, 0.20784315466880798, 818 0.26274511218070984, 0.3176470696926117, 0.1725490242242813 819 ], 820 'descriptor': {shape: [1, 6, 6, 1], dataType: 'float32'} 821 } 822 } 823 } 824 }, 825 { 826 'name': 'quantized element-wise binary sub', 827 'graph': { 828 'inputs': { 829 'inputA': { 830 'data': [ 831 15.57776927947998, -62.7008056640625, 832 82.55709075927734, -74.90638732910156, 833 ], 834 'descriptor': {shape: [2, 2], dataType: 'float32'}, 835 'constant': false 836 }, 837 'inputAScale': { 838 'data': [0.617084980010986], 839 'descriptor': {shape: [1, 1], dataType: 'float32'}, 840 'constant': true 841 }, 842 'inputAZeroPoint': { 843 'data': [120], 844 'descriptor': {shape: [1, 1], dataType: 'int8'}, 845 'constant': true 846 }, 847 'inputB': { 848 'data': [ 849 12, 9, 2, 43, 850 ], 851 'descriptor': {shape: [2, 2], dataType: 'int8'}, 852 'constant': true 853 }, 854 'inputBScale': { 855 'data': [0.617084980010986], 856 'descriptor': {shape: [1, 1], dataType: 'float32'}, 857 'constant': true 858 }, 859 'inputBZeroPoint': { 860 'data': [120], 861 'descriptor': {shape: [1, 1], dataType: 'int8'}, 862 'constant': true 863 }, 864 'outputScale': { 865 'data': [0.617084980010986], 866 'descriptor': {shape: [1, 1], dataType: 'float32'}, 867 'constant': true 868 }, 869 'outputZeroPoint': { 870 'data': [120], 871 'descriptor': {shape: [1, 1], dataType: 'int8'}, 872 'constant': true 873 }, 874 }, 875 'operators': [ 876 { 877 'name': 'quantizeLinear', 878 'arguments': [ 879 {'input': 'inputA'}, 880 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 881 ], 882 'outputs': 'quantizedInputA' 883 }, 884 { 885 'name': 'dequantizeLinear', 886 'arguments': [ 887 {'input': 'quantizedInputA'}, 888 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 889 ], 890 'outputs': 'dequantizedInputA' 891 }, 892 { 893 'name': 'dequantizeLinear', 894 'arguments': [ 895 {'input': 'inputB'}, 896 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 897 ], 898 'outputs': 'dequantizedInputB' 899 }, 900 { 901 'name': 'sub', 902 'arguments': [ 903 {'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'} 904 ], 905 'outputs': 'subOutput' 906 }, 907 { 908 'name': 'quantizeLinear', 909 'arguments': [ 910 {'input': 'subOutput'}, 911 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 912 ], 913 'outputs': 'quantizedSubOutput' 914 }, 915 { 916 'name': 'dequantizeLinear', 917 'arguments': [ 918 {'input': 'quantizedSubOutput'}, 919 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 920 ], 921 'outputs': 'output' 922 } 923 ], 924 'expectedOutputs': { 925 'output': { 926 'data': [ 927 4.319594860076904, 4.319594860076904, 4.319594860076904, 928 -27.1517391204834, 929 ], 930 'descriptor': {shape: [2, 2], dataType: 'float32'} 931 } 932 } 933 } 934 }, 935 { 936 'name': 'quantized element-wise binary mul', 937 'graph': { 938 'inputs': { 939 'inputA': { 940 'data': [ 941 49.1112174987793, 11.907459259033203, 942 21.115795135498047, 70.7490005493164, 943 ], 944 'descriptor': {shape: [2, 2], dataType: 'float32'}, 945 'constant': false 946 }, 947 'inputAScale': { 948 'data': [0.3921568859368563], 949 'descriptor': {shape: [1, 1], dataType: 'float32'}, 950 'constant': true 951 }, 952 'inputAZeroPoint': { 953 'data': [16], 954 'descriptor': {shape: [1, 1], dataType: 'int8'}, 955 'constant': true 956 }, 957 'inputB': { 958 'data': [ 959 21, 24, 960 8, 13 961 ], 962 'descriptor': {shape: [2, 2], dataType: 'int8'}, 963 'constant': true 964 }, 965 'inputBScale': { 966 'data': [0.3921568859368563], 967 'descriptor': {shape: [1, 1], dataType: 'float32'}, 968 'constant': true 969 }, 970 'inputBZeroPoint': { 971 'data': [16], 972 'descriptor': {shape: [1, 1], dataType: 'int8'}, 973 'constant': true 974 }, 975 'outputScale': { 976 'data': [0.3921568859368563], 977 'descriptor': {shape: [1, 1], dataType: 'float32'}, 978 'constant': true 979 }, 980 'outputZeroPoint': { 981 'data': [16], 982 'descriptor': {shape: [1, 1], dataType: 'int8'}, 983 'constant': true 984 }, 985 }, 986 'operators': [ 987 { 988 'name': 'quantizeLinear', 989 'arguments': [ 990 {'input': 'inputA'}, 991 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 992 ], 993 'outputs': 'quantizedInputA' 994 }, 995 { 996 'name': 'dequantizeLinear', 997 'arguments': [ 998 {'input': 'quantizedInputA'}, 999 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1000 ], 1001 'outputs': 'dequantizedInputA' 1002 }, 1003 { 1004 'name': 'dequantizeLinear', 1005 'arguments': [ 1006 {'input': 'inputB'}, 1007 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 1008 ], 1009 'outputs': 'dequantizedInputB' 1010 }, 1011 { 1012 'name': 'mul', 1013 'arguments': [ 1014 {'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'} 1015 ], 1016 'outputs': 'mulOutput' 1017 }, 1018 { 1019 'name': 'quantizeLinear', 1020 'arguments': [ 1021 {'input': 'mulOutput'}, 1022 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1023 ], 1024 'outputs': 'quantizedMulOutput' 1025 }, 1026 { 1027 'name': 'dequantizeLinear', 1028 'arguments': [ 1029 {'input': 'quantizedMulOutput'}, 1030 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1031 ], 1032 'outputs': 'output' 1033 } 1034 ], 1035 'expectedOutputs': { 1036 'output': { 1037 'data': [ 1038 43.529415130615234, 36.86274719238281, 1039 -56.4705924987793, -51.372554779052734, 1040 ], 1041 'descriptor': {shape: [2, 2], dataType: 'float32'} 1042 } 1043 } 1044 } 1045 }, 1046 { 1047 'name': 'quantized element-wise binary max', 1048 'graph': { 1049 'inputs': { 1050 'inputA': { 1051 'data': [ 1052 -2.549168109893799, -4.794857501983643, 1053 8.413617134094238, 6.108623504638672 1054 ], 1055 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1056 'constant': false 1057 }, 1058 'inputAScale': { 1059 'data': [0.343092918395996], 1060 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1061 'constant': true 1062 }, 1063 'inputAZeroPoint': { 1064 'data': [-128], 1065 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1066 'constant': true 1067 }, 1068 'inputB': { 1069 'data': [ 1070 12, 24, 35, 11, 1071 ], 1072 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1073 'constant': true 1074 }, 1075 'inputBScale': { 1076 'data': [0.343092918395996], 1077 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1078 'constant': true 1079 }, 1080 'inputBZeroPoint': { 1081 'data': [-128], 1082 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1083 'constant': true 1084 }, 1085 'outputScale': { 1086 'data': [0.343092918395996], 1087 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1088 'constant': true 1089 }, 1090 'outputZeroPoint': { 1091 'data': [-128], 1092 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1093 'constant': true 1094 }, 1095 }, 1096 'operators': [ 1097 { 1098 'name': 'quantizeLinear', 1099 'arguments': [ 1100 {'input': 'inputA'}, 1101 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1102 ], 1103 'outputs': 'quantizedInputA' 1104 }, 1105 { 1106 'name': 'dequantizeLinear', 1107 'arguments': [ 1108 {'input': 'quantizedInputA'}, 1109 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1110 ], 1111 'outputs': 'dequantizedInputA' 1112 }, 1113 { 1114 'name': 'dequantizeLinear', 1115 'arguments': [ 1116 {'input': 'inputB'}, 1117 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 1118 ], 1119 'outputs': 'dequantizedInputB' 1120 }, 1121 { 1122 'name': 'max', 1123 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1124 'outputs': 'maxOutput' 1125 }, 1126 { 1127 'name': 'quantizeLinear', 1128 'arguments': [ 1129 {'input': 'maxOutput'}, 1130 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1131 ], 1132 'outputs': 'quantizedMaxOutput' 1133 }, 1134 { 1135 'name': 'dequantizeLinear', 1136 'arguments': [ 1137 {'input': 'quantizedMaxOutput'}, 1138 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1139 ], 1140 'outputs': 'output' 1141 } 1142 ], 1143 'expectedOutputs': { 1144 'output': { 1145 'data': [ 1146 48.03300857543945, 52.150123596191406, 1147 55.92414474487305, 47.68991470336914, 1148 ], 1149 'descriptor': {shape: [2, 2], dataType: 'float32'} 1150 } 1151 } 1152 } 1153 }, 1154 { 1155 'name': 'quantized element-wise binary min', 1156 'graph': { 1157 'inputs': { 1158 'inputA': { 1159 'data': [ 1160 3.549168109893799, 4.794857501983643, 1161 8.413617134094238, 6.108623504638672 1162 ], 1163 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1164 'constant': false 1165 }, 1166 'inputAScale': { 1167 'data': [0.343092918395996], 1168 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1169 'constant': true 1170 }, 1171 'inputAZeroPoint': { 1172 'data': [-128], 1173 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1174 'constant': true 1175 }, 1176 'inputB': { 1177 'data': [ 1178 12, 24, 35, 11, 1179 ], 1180 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1181 'constant': true 1182 }, 1183 'inputBScale': { 1184 'data': [0.343092918395996], 1185 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1186 'constant': true 1187 }, 1188 'inputBZeroPoint': { 1189 'data': [-128], 1190 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1191 'constant': true 1192 }, 1193 'outputScale': { 1194 'data': [0.343092918395996], 1195 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1196 'constant': true 1197 }, 1198 'outputZeroPoint': { 1199 'data': [-128], 1200 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1201 'constant': true 1202 }, 1203 }, 1204 'operators': [ 1205 { 1206 'name': 'quantizeLinear', 1207 'arguments': [ 1208 {'input': 'inputA'}, 1209 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1210 ], 1211 'outputs': 'quantizedInputA' 1212 }, 1213 { 1214 'name': 'dequantizeLinear', 1215 'arguments': [ 1216 {'input': 'quantizedInputA'}, 1217 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1218 ], 1219 'outputs': 'dequantizedInputA' 1220 }, 1221 { 1222 'name': 'dequantizeLinear', 1223 'arguments': [ 1224 {'input': 'inputB'}, 1225 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 1226 ], 1227 'outputs': 'dequantizedInputB' 1228 }, 1229 { 1230 'name': 'min', 1231 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1232 'outputs': 'minOutput' 1233 }, 1234 { 1235 'name': 'quantizeLinear', 1236 'arguments': [ 1237 {'input': 'minOutput'}, 1238 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1239 ], 1240 'outputs': 'quantizedMinOutput' 1241 }, 1242 { 1243 'name': 'dequantizeLinear', 1244 'arguments': [ 1245 {'input': 'quantizedMinOutput'}, 1246 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1247 ], 1248 'outputs': 'output' 1249 } 1250 ], 1251 'expectedOutputs': { 1252 'output': { 1253 'data': [ 1254 3.430929183959961, 4.803300857543945, 1255 8.577322959899902, 6.17567253112793, 1256 ], 1257 'descriptor': {shape: [2, 2], dataType: 'float32'} 1258 } 1259 } 1260 } 1261 }, 1262 { 1263 'name': 'quantized element-wise logical equal', 1264 'graph': { 1265 'inputs': { 1266 'inputA': { 1267 'data': [ 1268 -2.549168109893799, 0.794857501983643, 1269 8.413617134094238, 6.108623504638672 1270 ], 1271 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1272 'constant': false 1273 }, 1274 'inputB': { 1275 'data': [ 1276 -7, 2, 1277 2, 30, 1278 ], 1279 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1280 'constant': true 1281 }, 1282 'scale': { 1283 'data': [0.343092918395996], 1284 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1285 'constant': true 1286 }, 1287 'zeroPoint': { 1288 'data': [0], 1289 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1290 'constant': true 1291 }, 1292 }, 1293 'operators': [ 1294 { 1295 'name': 'quantizeLinear', 1296 'arguments': [ 1297 {'input': 'inputA'}, 1298 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1299 ], 1300 'outputs': 'quantizedInputA' 1301 }, 1302 { 1303 'name': 'dequantizeLinear', 1304 'arguments': [ 1305 {'input': 'quantizedInputA'}, 1306 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1307 ], 1308 'outputs': 'dequantizedInputA' 1309 }, 1310 { 1311 'name': 'dequantizeLinear', 1312 'arguments': [ 1313 {'input': 'inputB'}, 1314 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1315 ], 1316 'outputs': 'dequantizedInputB' 1317 }, 1318 { 1319 'name': 'equal', 1320 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1321 'outputs': 'equalOutput' 1322 }, 1323 { 1324 'name': 'cast', 1325 'arguments': [{'input': 'equalOutput'}, {'type': 'int32'}], 1326 'outputs': 'output' 1327 }, 1328 ], 1329 'expectedOutputs': { 1330 'output': { 1331 'data': [ 1332 1, 1, 1333 0, 0, 1334 ], 1335 'descriptor': {shape: [2, 2], dataType: 'int32'} 1336 } 1337 } 1338 } 1339 }, 1340 { 1341 'name': 'quantized element-wise logical notEqual', 1342 'graph': { 1343 'inputs': { 1344 'inputA': { 1345 'data': [ 1346 -2.549168109893799, 0.794857501983643, 1347 8.413617134094238, 6.108623504638672 1348 ], 1349 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1350 'constant': false 1351 }, 1352 'inputB': { 1353 'data': [ 1354 -7, 2, 1355 2, 30, 1356 ], 1357 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1358 'constant': true 1359 }, 1360 'scale': { 1361 'data': [0.343092918395996], 1362 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1363 'constant': true 1364 }, 1365 'zeroPoint': { 1366 'data': [0], 1367 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1368 'constant': true 1369 }, 1370 }, 1371 'operators': [ 1372 { 1373 'name': 'quantizeLinear', 1374 'arguments': [ 1375 {'input': 'inputA'}, 1376 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1377 ], 1378 'outputs': 'quantizedInputA' 1379 }, 1380 { 1381 'name': 'dequantizeLinear', 1382 'arguments': [ 1383 {'input': 'quantizedInputA'}, 1384 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1385 ], 1386 'outputs': 'dequantizedInputA' 1387 }, 1388 { 1389 'name': 'dequantizeLinear', 1390 'arguments': [ 1391 {'input': 'inputB'}, 1392 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1393 ], 1394 'outputs': 'dequantizedInputB' 1395 }, 1396 { 1397 'name': 'notEqual', 1398 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1399 'outputs': 'notEqualOutput' 1400 }, 1401 { 1402 'name': 'cast', 1403 'arguments': [{'input': 'notEqualOutput'}, {'type': 'int32'}], 1404 'outputs': 'output' 1405 }, 1406 ], 1407 'expectedOutputs': { 1408 'output': { 1409 'data': [ 1410 0, 0, 1411 1, 1, 1412 ], 1413 'descriptor': {shape: [2, 2], dataType: 'int32'} 1414 } 1415 } 1416 } 1417 }, 1418 { 1419 'name': 'quantized element-wise logical greater', 1420 'graph': { 1421 'inputs': { 1422 'inputA': { 1423 'data': [ 1424 -2.549168109893799, 0.794857501983643, 1425 8.413617134094238, 6.108623504638672 1426 ], 1427 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1428 'constant': false 1429 }, 1430 'inputB': { 1431 'data': [ 1432 -7, 2, 1433 2, 30, 1434 ], 1435 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1436 'constant': true 1437 }, 1438 'scale': { 1439 'data': [0.343092918395996], 1440 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1441 'constant': true 1442 }, 1443 'zeroPoint': { 1444 'data': [0], 1445 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1446 'constant': true 1447 }, 1448 }, 1449 'operators': [ 1450 { 1451 'name': 'quantizeLinear', 1452 'arguments': [ 1453 {'input': 'inputA'}, 1454 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1455 ], 1456 'outputs': 'quantizedInputA' 1457 }, 1458 { 1459 'name': 'dequantizeLinear', 1460 'arguments': [ 1461 {'input': 'quantizedInputA'}, 1462 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1463 ], 1464 'outputs': 'dequantizedInputA' 1465 }, 1466 { 1467 'name': 'dequantizeLinear', 1468 'arguments': [ 1469 {'input': 'inputB'}, 1470 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1471 ], 1472 'outputs': 'dequantizedInputB' 1473 }, 1474 { 1475 'name': 'greater', 1476 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1477 'outputs': 'greaterOutput' 1478 }, 1479 { 1480 'name': 'cast', 1481 'arguments': [{'input': 'greaterOutput'}, {'type': 'int32'}], 1482 'outputs': 'output' 1483 }, 1484 ], 1485 'expectedOutputs': { 1486 'output': { 1487 'data': [ 1488 0, 0, 1489 1, 0, 1490 ], 1491 'descriptor': {shape: [2, 2], dataType: 'int32'} 1492 } 1493 } 1494 } 1495 }, 1496 { 1497 'name': 'quantized element-wise logical greaterOrEqual', 1498 'graph': { 1499 'inputs': { 1500 'inputA': { 1501 'data': [ 1502 -2.549168109893799, 0.794857501983643, 1503 8.413617134094238, 6.108623504638672 1504 ], 1505 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1506 'constant': false 1507 }, 1508 'inputB': { 1509 'data': [ 1510 -7, 2, 1511 2, 30, 1512 ], 1513 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1514 'constant': true 1515 }, 1516 'scale': { 1517 'data': [0.343092918395996], 1518 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1519 'constant': true 1520 }, 1521 'zeroPoint': { 1522 'data': [0], 1523 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1524 'constant': true 1525 }, 1526 }, 1527 'operators': [ 1528 { 1529 'name': 'quantizeLinear', 1530 'arguments': [ 1531 {'input': 'inputA'}, 1532 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1533 ], 1534 'outputs': 'quantizedInputA' 1535 }, 1536 { 1537 'name': 'dequantizeLinear', 1538 'arguments': [ 1539 {'input': 'quantizedInputA'}, 1540 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1541 ], 1542 'outputs': 'dequantizedInputA' 1543 }, 1544 { 1545 'name': 'dequantizeLinear', 1546 'arguments': [ 1547 {'input': 'inputB'}, 1548 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1549 ], 1550 'outputs': 'dequantizedInputB' 1551 }, 1552 { 1553 'name': 'greaterOrEqual', 1554 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1555 'outputs': 'greaterOrEqualOutput' 1556 }, 1557 { 1558 'name': 'cast', 1559 'arguments': [{'input': 'greaterOrEqualOutput'}, {'type': 'int32'}], 1560 'outputs': 'output' 1561 }, 1562 ], 1563 'expectedOutputs': { 1564 'output': { 1565 'data': [ 1566 1, 1, 1567 1, 0, 1568 ], 1569 'descriptor': {shape: [2, 2], dataType: 'int32'} 1570 } 1571 } 1572 } 1573 }, 1574 { 1575 'name': 'quantized element-wise logical lesser', 1576 'graph': { 1577 'inputs': { 1578 'inputA': { 1579 'data': [ 1580 -2.549168109893799, 0.794857501983643, 1581 8.413617134094238, 6.108623504638672 1582 ], 1583 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1584 'constant': false 1585 }, 1586 'inputB': { 1587 'data': [ 1588 -7, 2, 1589 2, 30, 1590 ], 1591 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1592 'constant': true 1593 }, 1594 'scale': { 1595 'data': [0.343092918395996], 1596 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1597 'constant': true 1598 }, 1599 'zeroPoint': { 1600 'data': [0], 1601 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1602 'constant': true 1603 }, 1604 }, 1605 'operators': [ 1606 { 1607 'name': 'quantizeLinear', 1608 'arguments': [ 1609 {'input': 'inputA'}, 1610 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1611 ], 1612 'outputs': 'quantizedInputA' 1613 }, 1614 { 1615 'name': 'dequantizeLinear', 1616 'arguments': [ 1617 {'input': 'quantizedInputA'}, 1618 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1619 ], 1620 'outputs': 'dequantizedInputA' 1621 }, 1622 { 1623 'name': 'dequantizeLinear', 1624 'arguments': [ 1625 {'input': 'inputB'}, 1626 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1627 ], 1628 'outputs': 'dequantizedInputB' 1629 }, 1630 { 1631 'name': 'lesser', 1632 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1633 'outputs': 'lesserOutput' 1634 }, 1635 { 1636 'name': 'cast', 1637 'arguments': [{'input': 'lesserOutput'}, {'type': 'int32'}], 1638 'outputs': 'output' 1639 }, 1640 ], 1641 'expectedOutputs': { 1642 'output': { 1643 'data': [ 1644 0, 0, 1645 0, 1, 1646 ], 1647 'descriptor': {shape: [2, 2], dataType: 'int32'} 1648 } 1649 } 1650 } 1651 }, 1652 { 1653 'name': 'quantized element-wise logical lesserOrEqual', 1654 'graph': { 1655 'inputs': { 1656 'inputA': { 1657 'data': [ 1658 -2.549168109893799, 0.794857501983643, 1659 8.413617134094238, 6.108623504638672 1660 ], 1661 'descriptor': {shape: [2, 2], dataType: 'float32'}, 1662 'constant': false 1663 }, 1664 'inputB': { 1665 'data': [ 1666 -7, 2, 1667 2, 30, 1668 ], 1669 'descriptor': {shape: [2, 2], dataType: 'int8'}, 1670 'constant': true 1671 }, 1672 'scale': { 1673 'data': [0.343092918395996], 1674 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1675 'constant': true 1676 }, 1677 'zeroPoint': { 1678 'data': [0], 1679 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1680 'constant': true 1681 }, 1682 }, 1683 'operators': [ 1684 { 1685 'name': 'quantizeLinear', 1686 'arguments': [ 1687 {'input': 'inputA'}, 1688 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1689 ], 1690 'outputs': 'quantizedInputA' 1691 }, 1692 { 1693 'name': 'dequantizeLinear', 1694 'arguments': [ 1695 {'input': 'quantizedInputA'}, 1696 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1697 ], 1698 'outputs': 'dequantizedInputA' 1699 }, 1700 { 1701 'name': 'dequantizeLinear', 1702 'arguments': [ 1703 {'input': 'inputB'}, 1704 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 1705 ], 1706 'outputs': 'dequantizedInputB' 1707 }, 1708 { 1709 'name': 'lesserOrEqual', 1710 'arguments': [{'inputA': 'dequantizedInputA'}, {'inputB': 'dequantizedInputB'}], 1711 'outputs': 'lesserOrEqualOutput' 1712 }, 1713 { 1714 'name': 'cast', 1715 'arguments': [{'input': 'lesserOrEqualOutput'}, {'type': 'int32'}], 1716 'outputs': 'output' 1717 }, 1718 ], 1719 'expectedOutputs': { 1720 'output': { 1721 'data': [ 1722 1, 1, 1723 0, 1, 1724 ], 1725 'descriptor': {shape: [2, 2], dataType: 'int32'} 1726 } 1727 } 1728 } 1729 }, 1730 { 1731 'name': 'quantized gather', 1732 'graph': { 1733 'inputs': { 1734 'input': { 1735 'data': [ 1736 2.549168109893799, 4.794857501983643, 7.413617134094238, 1737 8.413617134094238, 6.108623504638672, 3.549168109893799, 1738 ], 1739 'descriptor': {shape: [2, 3], dataType: 'float32'}, 1740 'constant': false 1741 }, 1742 'inputScale': { 1743 'data': [0.343092918395996], 1744 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1745 'constant': true 1746 }, 1747 'inputZeroPoint': { 1748 'data': [-128], 1749 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1750 'constant': true 1751 }, 1752 'gatherIndices': { 1753 'data': [1], 1754 'descriptor': {shape: [], dataType: 'int32'}, 1755 'constant': true 1756 }, 1757 'outputScale': { 1758 'data': [0.343092918395996], 1759 'descriptor': {shape: [1], dataType: 'float32'}, 1760 'constant': true 1761 }, 1762 'outputZeroPoint': { 1763 'data': [-128], 1764 'descriptor': {shape: [1], dataType: 'int8'}, 1765 'constant': true 1766 }, 1767 }, 1768 'operators': [ 1769 { 1770 'name': 'quantizeLinear', 1771 'arguments': [ 1772 {'input': 'input'}, 1773 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 1774 ], 1775 'outputs': 'quantizedInput' 1776 }, 1777 { 1778 'name': 'dequantizeLinear', 1779 'arguments': [ 1780 {'input': 'quantizedInput'}, 1781 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 1782 ], 1783 'outputs': 'dequantizedInput' 1784 }, 1785 { 1786 'name': 'gather', 1787 'arguments': [{'input': 'dequantizedInput'}, {'indices': 'gatherIndices'}], 1788 'outputs': 'gatherOutput' 1789 }, 1790 { 1791 'name': 'quantizeLinear', 1792 'arguments': [ 1793 {'input': 'gatherOutput'}, 1794 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1795 ], 1796 'outputs': 'quantizedGatherOutput' 1797 }, 1798 { 1799 'name': 'dequantizeLinear', 1800 'arguments': [ 1801 {'input': 'quantizedGatherOutput'}, 1802 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1803 ], 1804 'outputs': 'output' 1805 } 1806 ], 1807 'expectedOutputs': { 1808 'output': { 1809 'data': [ 1810 8.577322959899902, 6.17567253112793, 3.430929183959961, 1811 ], 1812 'descriptor': {shape: [3], dataType: 'float32'} 1813 } 1814 } 1815 } 1816 }, 1817 { 1818 'name': 'quantized gemm with bias', 1819 'graph': { 1820 'inputs': { 1821 'inputA': { 1822 'data': [ 1823 49.1112174987793, 11.907459259033203, 11.115795135498047, 1824 21.115795135498047, 70.7490005493164, 31.115795135498047 1825 ], 1826 'descriptor': {shape: [2, 3], dataType: 'float32'}, 1827 'constant': false 1828 }, 1829 'inputAScale': { 1830 'data': [0.003921568859368563], 1831 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1832 'constant': true 1833 }, 1834 'inputAZeroPoint': { 1835 'data': [-128], 1836 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1837 'constant': true 1838 }, 1839 'inputB': { 1840 'data': [ 1841 21, 24, 8, 15, 6, 7 1842 ], 1843 'descriptor': {shape: [3, 2], dataType: 'int8'}, 1844 'constant': true 1845 }, 1846 'inputBScale': { 1847 'data': [0.023458752938762234], 1848 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1849 'constant': true 1850 }, 1851 'inputBZeroPoint': { 1852 'data': [0], 1853 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1854 'constant': true 1855 }, 1856 'inputC': { 1857 'data': [ 1858 8, 15 1859 ], 1860 'descriptor': {shape: [2], dataType: 'int32'}, 1861 'constant': true 1862 }, 1863 'inputCScale': { 1864 'data': [0.000091995115004270], 1865 'descriptor': {shape: [1], dataType: 'float32'}, 1866 'constant': true 1867 }, 1868 'inputCZeroPoint': { 1869 'data': [0], 1870 'descriptor': {shape: [1], dataType: 'int32'}, 1871 'constant': true 1872 }, 1873 'outputScale': { 1874 'data': [0.3921568859368563], 1875 'descriptor': {shape: [1, 1], dataType: 'float32'}, 1876 'constant': true 1877 }, 1878 'outputZeroPoint': { 1879 'data': [16], 1880 'descriptor': {shape: [1, 1], dataType: 'int8'}, 1881 'constant': true 1882 }, 1883 }, 1884 'operators': [ 1885 { 1886 'name': 'quantizeLinear', 1887 'arguments': [ 1888 {'input': 'inputA'}, 1889 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1890 ], 1891 'outputs': 'quantizedInputA' 1892 }, 1893 { 1894 'name': 'dequantizeLinear', 1895 'arguments': [ 1896 {'input': 'quantizedInputA'}, 1897 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 1898 ], 1899 'outputs': 'dequantizedInputA' 1900 }, 1901 { 1902 'name': 'dequantizeLinear', 1903 'arguments': [ 1904 {'input': 'inputB'}, 1905 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 1906 ], 1907 'outputs': 'dequantizedInputB' 1908 }, 1909 { 1910 'name': 'dequantizeLinear', 1911 'arguments': [ 1912 {'input': 'inputC'}, 1913 {'scale': 'inputCScale', 'zeroPoint': 'inputCZeroPoint'} 1914 ], 1915 'outputs': 'dequantizedInputC' 1916 }, 1917 { 1918 'name': 'gemm', 1919 'arguments': [ 1920 {'a': 'dequantizedInputA'}, {'b': 'dequantizedInputB'}, 1921 {'options': {'c': 'dequantizedInputC'}} 1922 ], 1923 'outputs': 'gemmOutput' 1924 }, 1925 { 1926 'name': 'quantizeLinear', 1927 'arguments': [ 1928 {'input': 'gemmOutput'}, 1929 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1930 ], 1931 'outputs': 'quantizedGemmOutput' 1932 }, 1933 { 1934 'name': 'dequantizeLinear', 1935 'arguments': [ 1936 {'input': 'quantizedGemmOutput'}, 1937 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 1938 ], 1939 'outputs': 'output' 1940 } 1941 ], 1942 'expectedOutputs': { 1943 'output': { 1944 'data': [ 1945 0.7843137979507446, 1.1764707565307617, 1946 0.7843137979507446, 1.1764707565307617, 1947 ], 1948 'descriptor': {shape: [2, 2], dataType: 'float32'} 1949 } 1950 } 1951 } 1952 }, 1953 { 1954 'name': 'quantized transpose', 1955 'graph': { 1956 'inputs': { 1957 'input': { 1958 'data': [ 1959 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, 1960 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, 1961 ], 1962 'descriptor': {shape: [1, 1, 2, 3], dataType: 'float32'}, 1963 'constant': false 1964 }, 1965 'inputScale': { 1966 'data': [0.003921568859368563], 1967 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 1968 'constant': true 1969 }, 1970 'inputZeroPoint': { 1971 'data': [-128], 1972 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 1973 'constant': true 1974 }, 1975 'outputScale': { 1976 'data': [0.003921568859368563], 1977 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 1978 'constant': true 1979 }, 1980 'outputZeroPoint': { 1981 'data': [-128], 1982 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 1983 'constant': true 1984 }, 1985 }, 1986 'operators': [ 1987 { 1988 'name': 'quantizeLinear', 1989 'arguments': [ 1990 {'input': 'input'}, 1991 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 1992 ], 1993 'outputs': 'quantizedInput' 1994 }, 1995 { 1996 'name': 'dequantizeLinear', 1997 'arguments': [ 1998 {'input': 'quantizedInput'}, 1999 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2000 ], 2001 'outputs': 'dequantizedInput' 2002 }, 2003 { 2004 'name': 'transpose', 2005 'arguments': [{'input': 'dequantizedInput'}], 2006 'outputs': 'transposeOutput' 2007 }, 2008 { 2009 'name': 'quantizeLinear', 2010 'arguments': [ 2011 {'input': 'transposeOutput'}, 2012 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2013 ], 2014 'outputs': 'quantizedTransposeOutput' 2015 }, 2016 { 2017 'name': 'dequantizeLinear', 2018 'arguments': [ 2019 {'input': 'quantizedTransposeOutput'}, 2020 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2021 ], 2022 'outputs': 'output' 2023 } 2024 ], 2025 'expectedOutputs': { 2026 'output': { 2027 'data': [ 2028 0.6823529601097107, 0.20000001788139343, 2029 0.0470588281750679, 0.4117647409439087, 2030 0.3333333432674408, 0.0784313753247261, 2031 ], 2032 'descriptor': {shape: [3, 2, 1, 1], dataType: 'float32'} 2033 } 2034 } 2035 } 2036 }, 2037 { 2038 'name': 'quantized tanh', 2039 'graph': { 2040 'inputs': { 2041 'input': { 2042 'data': [ 2043 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2044 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, 2045 ], 2046 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2047 'constant': false 2048 }, 2049 'inputScale': { 2050 'data': [0.003921568859368563], 2051 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2052 'constant': true 2053 }, 2054 'inputZeroPoint': { 2055 'data': [-128], 2056 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2057 'constant': true 2058 }, 2059 'outputScale': { 2060 'data': [0.003921568859368563], 2061 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2062 'constant': true 2063 }, 2064 'outputZeroPoint': { 2065 'data': [-128], 2066 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2067 'constant': true 2068 }, 2069 }, 2070 'operators': [ 2071 { 2072 'name': 'quantizeLinear', 2073 'arguments': [ 2074 {'input': 'input'}, 2075 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2076 ], 2077 'outputs': 'quantizedInput' 2078 }, 2079 { 2080 'name': 'dequantizeLinear', 2081 'arguments': [ 2082 {'input': 'quantizedInput'}, 2083 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2084 ], 2085 'outputs': 'dequantizedInput' 2086 }, 2087 { 2088 'name': 'tanh', 2089 'arguments': [{'input': 'dequantizedInput'}], 2090 'outputs': 'tanhOutput' 2091 }, 2092 { 2093 'name': 'quantizeLinear', 2094 'arguments': [ 2095 {'input': 'tanhOutput'}, 2096 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2097 ], 2098 'outputs': 'quantizedTanhOutput' 2099 }, 2100 { 2101 'name': 'dequantizeLinear', 2102 'arguments': [ 2103 {'input': 'quantizedTanhOutput'}, 2104 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2105 ], 2106 'outputs': 'output' 2107 } 2108 ], 2109 'expectedOutputs': { 2110 'output': { 2111 'data': [ 2112 0.5921568870544434, 0.0470588281750679, 0.32156863808631897, 2113 0.19607844948768616, 0.38823533058166504, 0.0784313753247261, 2114 ], 2115 'descriptor': {shape: [2, 3], dataType: 'float32'} 2116 } 2117 } 2118 } 2119 }, 2120 { 2121 'name': 'quantized sigmoid', 2122 'graph': { 2123 'inputs': { 2124 'input': { 2125 'data': [ 2126 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2127 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, 2128 ], 2129 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2130 'constant': false 2131 }, 2132 'inputScale': { 2133 'data': [0.00390625], 2134 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2135 'constant': true 2136 }, 2137 'inputZeroPoint': { 2138 'data': [-128], 2139 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2140 'constant': true 2141 }, 2142 'outputScale': { 2143 'data': [0.00390625], 2144 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2145 'constant': true 2146 }, 2147 'outputZeroPoint': { 2148 'data': [-128], 2149 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2150 'constant': true 2151 }, 2152 }, 2153 'operators': [ 2154 { 2155 'name': 'quantizeLinear', 2156 'arguments': [ 2157 {'input': 'input'}, 2158 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2159 ], 2160 'outputs': 'quantizedInput' 2161 }, 2162 { 2163 'name': 'dequantizeLinear', 2164 'arguments': [ 2165 {'input': 'quantizedInput'}, 2166 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2167 ], 2168 'outputs': 'dequantizedInput' 2169 }, 2170 { 2171 'name': 'sigmoid', 2172 'arguments': [{'input': 'dequantizedInput'}], 2173 'outputs': 'sigmoidOutput' 2174 }, 2175 { 2176 'name': 'quantizeLinear', 2177 'arguments': [ 2178 {'input': 'sigmoidOutput'}, 2179 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2180 ], 2181 'outputs': 'quantizedSigmoidOutput' 2182 }, 2183 { 2184 'name': 'dequantizeLinear', 2185 'arguments': [ 2186 {'input': 'quantizedSigmoidOutput'}, 2187 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2188 ], 2189 'outputs': 'output' 2190 } 2191 ], 2192 'expectedOutputs': { 2193 'output': { 2194 'data': [ 2195 0.6640625, 0.51171875, 0.58203125, 2196 0.55078125, 0.6015625, 0.51953125, 2197 ], 2198 'descriptor': {shape: [2, 3], dataType: 'float32'} 2199 } 2200 } 2201 } 2202 }, 2203 { 2204 'name': 'quantized leaky relu', 2205 'graph': { 2206 'inputs': { 2207 'input': { 2208 'data': [ 2209 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2210 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 2211 ], 2212 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2213 'constant': false 2214 }, 2215 'inputScale': { 2216 'data': [0.003921568859368563], 2217 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2218 'constant': true 2219 }, 2220 'inputZeroPoint': { 2221 'data': [0], 2222 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2223 'constant': true 2224 }, 2225 'outputScale': { 2226 'data': [0.003921568859368563], 2227 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2228 'constant': true 2229 }, 2230 'outputZeroPoint': { 2231 'data': [0], 2232 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2233 'constant': true 2234 }, 2235 }, 2236 'operators': [ 2237 { 2238 'name': 'quantizeLinear', 2239 'arguments': [ 2240 {'input': 'input'}, 2241 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2242 ], 2243 'outputs': 'quantizedInput' 2244 }, 2245 { 2246 'name': 'dequantizeLinear', 2247 'arguments': [ 2248 {'input': 'quantizedInput'}, 2249 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2250 ], 2251 'outputs': 'dequantizedInput' 2252 }, 2253 { 2254 'name': 'leakyRelu', 2255 'arguments': [ 2256 {'input': 'dequantizedInput'}, 2257 {'options': {'alpha': 5.799162942273234}} 2258 ], 2259 'outputs': 'leakyReluOutput' 2260 }, 2261 { 2262 'name': 'quantizeLinear', 2263 'arguments': [ 2264 {'input': 'leakyReluOutput'}, 2265 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2266 ], 2267 'outputs': 'quantizedLeakyReluOutput' 2268 }, 2269 { 2270 'name': 'dequantizeLinear', 2271 'arguments': [ 2272 {'input': 'quantizedLeakyReluOutput'}, 2273 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2274 ], 2275 'outputs': 'output' 2276 } 2277 ], 2278 'expectedOutputs': { 2279 'output': { 2280 'data': [ 2281 0.49803924560546875, 0.0470588281750679, 0.3333333432674408, 2282 -0.501960813999176, -0.02352941408753395, -0.364705890417099, 2283 ], 2284 'descriptor': {shape: [2, 3], dataType: 'float32'} 2285 } 2286 } 2287 } 2288 }, 2289 { 2290 'name': 'quantized concat', 2291 'graph': { 2292 'inputs': { 2293 'inputA': { 2294 'data': [ 2295 -0.990639865398407, -0.576785683631897, -0.32276400923728943, 2296 -0.44735023379325867, -0.11028251051902771, -0.5945112705230713, 2297 ], 2298 'descriptor': {shape: [3, 2], dataType: 'float32'}, 2299 'constant': false 2300 }, 2301 'inputAScale': { 2302 'data': [0.003921568859368563], 2303 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2304 'constant': true 2305 }, 2306 'inputAZeroPoint': { 2307 'data': [127], 2308 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2309 'constant': true 2310 }, 2311 'inputB': { 2312 'data': [ 2313 2, 27, 38, 2314 ], 2315 'descriptor': {shape: [3, 1], dataType: 'int8'}, 2316 'constant': true 2317 }, 2318 'inputBScale': { 2319 'data': [0.003921568859368563], 2320 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2321 'constant': true 2322 }, 2323 'inputBZeroPoint': { 2324 'data': [127], 2325 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2326 'constant': true 2327 }, 2328 'outputScale': { 2329 'data': [0.003921568859368563], 2330 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2331 'constant': true 2332 }, 2333 'outputZeroPoint': { 2334 'data': [127], 2335 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2336 'constant': true 2337 }, 2338 }, 2339 'operators': [ 2340 { 2341 'name': 'quantizeLinear', 2342 'arguments': [ 2343 {'input': 'inputA'}, 2344 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 2345 ], 2346 'outputs': 'quantizedInputA' 2347 }, 2348 { 2349 'name': 'dequantizeLinear', 2350 'arguments': [ 2351 {'input': 'quantizedInputA'}, 2352 {'scale': 'inputAScale', 'zeroPoint': 'inputAZeroPoint'} 2353 ], 2354 'outputs': 'dequantizedInputA' 2355 }, 2356 { 2357 'name': 'dequantizeLinear', 2358 'arguments': [ 2359 {'input': 'inputB'}, 2360 {'scale': 'inputBScale', 'zeroPoint': 'inputBZeroPoint'} 2361 ], 2362 'outputs': 'dequantizedInputB' 2363 }, 2364 { 2365 'name': 'concat', 2366 'arguments': [ 2367 { 2368 'inputs': ['dequantizedInputA', 'dequantizedInputB'] 2369 }, 2370 {'axis': 1} 2371 ], 2372 'outputs': 'concatOutput' 2373 }, 2374 { 2375 'name': 'quantizeLinear', 2376 'arguments': [ 2377 {'input': 'concatOutput'}, 2378 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2379 ], 2380 'outputs': 'quantizedConcatOutput' 2381 }, 2382 { 2383 'name': 'dequantizeLinear', 2384 'arguments': [ 2385 {'input': 'quantizedConcatOutput'}, 2386 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2387 ], 2388 'outputs': 'output' 2389 } 2390 ], 2391 'expectedOutputs': { 2392 'output': { 2393 'data': [ 2394 -0.9921569228172302, -0.5764706134796143, -0.4901961088180542, 2395 -0.32156863808631897, -0.44705885648727417, -0.3921568989753723, 2396 -0.1098039299249649, -0.5960784554481506, -0.3490196168422699, 2397 ], 2398 'descriptor': {shape: [3, 3], dataType: 'float32'} 2399 } 2400 } 2401 } 2402 }, 2403 { 2404 'name': 'quantized elu', 2405 'graph': { 2406 'inputs': { 2407 'input': { 2408 'data': [ 2409 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2410 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 2411 ], 2412 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2413 'constant': false 2414 }, 2415 'inputScale': { 2416 'data': [0.003921568859368563], 2417 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2418 'constant': true 2419 }, 2420 'inputZeroPoint': { 2421 'data': [0], 2422 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2423 'constant': true 2424 }, 2425 'outputScale': { 2426 'data': [0.003921568859368563], 2427 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2428 'constant': true 2429 }, 2430 'outputZeroPoint': { 2431 'data': [0], 2432 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2433 'constant': true 2434 }, 2435 }, 2436 'operators': [ 2437 { 2438 'name': 'quantizeLinear', 2439 'arguments': [ 2440 {'input': 'input'}, 2441 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2442 ], 2443 'outputs': 'quantizedInput' 2444 }, 2445 { 2446 'name': 'dequantizeLinear', 2447 'arguments': [ 2448 {'input': 'quantizedInput'}, 2449 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2450 ], 2451 'outputs': 'dequantizedInput' 2452 }, 2453 { 2454 'name': 'elu', 2455 'arguments': [{'input': 'dequantizedInput'}], 2456 'outputs': 'eluOutput' 2457 }, 2458 { 2459 'name': 'quantizeLinear', 2460 'arguments': [ 2461 {'input': 'eluOutput'}, 2462 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2463 ], 2464 'outputs': 'quantizedEluOutput' 2465 }, 2466 { 2467 'name': 'dequantizeLinear', 2468 'arguments': [ 2469 {'input': 'quantizedEluOutput'}, 2470 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2471 ], 2472 'outputs': 'output' 2473 } 2474 ], 2475 'expectedOutputs': { 2476 'output': { 2477 'data': [ 2478 0.49803924560546875, 0.0470588281750679, 0.3333333432674408, 2479 -0.18039216101169586, -0.003921568859368563, -0.062745101749897, 2480 ], 2481 'descriptor': {shape: [2, 3], dataType: 'float32'} 2482 } 2483 } 2484 } 2485 }, 2486 { 2487 'name': 'quantized averagePool2d', 2488 'graph': { 2489 'inputs': { 2490 'input': { 2491 'data': [ 2492 -2.549168109893799, -4.794857501983643, 2493 8.413617134094238, 6.108623504638672 2494 ], 2495 'descriptor': {shape: [1, 2, 2, 1], dataType: 'float32'}, 2496 'constant': false 2497 }, 2498 'inputScale': { 2499 'data': [0.343092918395996], 2500 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 2501 'constant': true 2502 }, 2503 'inputZeroPoint': { 2504 'data': [-128], 2505 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 2506 'constant': true 2507 }, 2508 'outputScale': { 2509 'data': [0.343092918395996], 2510 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 2511 'constant': true 2512 }, 2513 'outputZeroPoint': { 2514 'data': [-128], 2515 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 2516 'constant': true 2517 }, 2518 }, 2519 'operators': [ 2520 { 2521 'name': 'quantizeLinear', 2522 'arguments': [ 2523 {'input': 'input'}, 2524 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2525 ], 2526 'outputs': 'quantizedInput' 2527 }, 2528 { 2529 'name': 'dequantizeLinear', 2530 'arguments': [ 2531 {'input': 'quantizedInput'}, 2532 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2533 ], 2534 'outputs': 'dequantizedInput' 2535 }, 2536 { 2537 'name': 'averagePool2d', 2538 'arguments': [{'input': 'dequantizedInput'}, {'options': {'layout': 'nhwc'}}], 2539 'outputs': 'averagePool2dOutput' 2540 }, 2541 { 2542 'name': 'quantizeLinear', 2543 'arguments': [ 2544 {'input': 'averagePool2dOutput'}, 2545 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2546 ], 2547 'outputs': 'quantizedAveragePool2dOutput' 2548 }, 2549 { 2550 'name': 'dequantizeLinear', 2551 'arguments': [ 2552 {'input': 'quantizedAveragePool2dOutput'}, 2553 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2554 ], 2555 'outputs': 'output' 2556 } 2557 ], 2558 'expectedOutputs': { 2559 'output': { 2560 'data': [ 2561 3.774022102355957, 2562 ], 2563 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 2564 } 2565 } 2566 } 2567 }, 2568 { 2569 'name': 'quantized maxPool2d', 2570 'graph': { 2571 'inputs': { 2572 'input': { 2573 'data': [ 2574 -2.549168109893799, -4.794857501983643, 2575 8.413617134094238, 6.108623504638672 2576 ], 2577 'descriptor': {shape: [1, 2, 2, 1], dataType: 'float32'}, 2578 'constant': false 2579 }, 2580 'inputScale': { 2581 'data': [0.343092918395996], 2582 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 2583 'constant': true 2584 }, 2585 'inputZeroPoint': { 2586 'data': [-128], 2587 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 2588 'constant': true 2589 }, 2590 'outputScale': { 2591 'data': [0.343092918395996], 2592 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 2593 'constant': true 2594 }, 2595 'outputZeroPoint': { 2596 'data': [-128], 2597 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 2598 'constant': true 2599 }, 2600 }, 2601 'operators': [ 2602 { 2603 'name': 'quantizeLinear', 2604 'arguments': [ 2605 {'input': 'input'}, 2606 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2607 ], 2608 'outputs': 'quantizedInput' 2609 }, 2610 { 2611 'name': 'dequantizeLinear', 2612 'arguments': [ 2613 {'input': 'quantizedInput'}, 2614 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2615 ], 2616 'outputs': 'dequantizedInput' 2617 }, 2618 { 2619 'name': 'maxPool2d', 2620 'arguments': [{'input': 'dequantizedInput'}, {'options': {'layout': 'nhwc'}}], 2621 'outputs': 'maxPool2dOutput' 2622 }, 2623 { 2624 'name': 'quantizeLinear', 2625 'arguments': [ 2626 {'input': 'maxPool2dOutput'}, 2627 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2628 ], 2629 'outputs': 'quantizedMaxPool2dOutput' 2630 }, 2631 { 2632 'name': 'dequantizeLinear', 2633 'arguments': [ 2634 {'input': 'quantizedMaxPool2dOutput'}, 2635 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2636 ], 2637 'outputs': 'output' 2638 } 2639 ], 2640 'expectedOutputs': { 2641 'output': { 2642 'data': [ 2643 8.577322959899902, 2644 ], 2645 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'} 2646 } 2647 } 2648 } 2649 }, 2650 { 2651 'name': 'quantized reshape', 2652 'graph': { 2653 'inputs': { 2654 'input': { 2655 'data': [ 2656 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2657 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 2658 ], 2659 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2660 'constant': false 2661 }, 2662 'inputScale': { 2663 'data': [0.003921568859368563], 2664 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2665 'constant': true 2666 }, 2667 'inputZeroPoint': { 2668 'data': [16], 2669 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2670 'constant': true 2671 }, 2672 'outputScale': { 2673 'data': [0.003921568859368563], 2674 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2675 'constant': true 2676 }, 2677 'outputZeroPoint': { 2678 'data': [16], 2679 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2680 'constant': true 2681 }, 2682 }, 2683 'operators': [ 2684 { 2685 'name': 'quantizeLinear', 2686 'arguments': [ 2687 {'input': 'input'}, 2688 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2689 ], 2690 'outputs': 'quantizedInput' 2691 }, 2692 { 2693 'name': 'dequantizeLinear', 2694 'arguments': [ 2695 {'input': 'quantizedInput'}, 2696 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2697 ], 2698 'outputs': 'dequantizedInput' 2699 }, 2700 { 2701 'name': 'reshape', 2702 'arguments': [{'input': 'dequantizedInput'}, {'newShape': [3, 2]}], 2703 'outputs': 'reshapeOutput' 2704 }, 2705 { 2706 'name': 'quantizeLinear', 2707 'arguments': [ 2708 {'input': 'reshapeOutput'}, 2709 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2710 ], 2711 'outputs': 'quantizedReshapeOutput' 2712 }, 2713 { 2714 'name': 'dequantizeLinear', 2715 'arguments': [ 2716 {'input': 'quantizedReshapeOutput'}, 2717 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2718 ], 2719 'outputs': 'output' 2720 } 2721 ], 2722 'expectedOutputs': { 2723 'output': { 2724 'data': [ 2725 0.43529415130615234, 0.0470588281750679, 2726 0.3333333432674408, -0.20000001788139343, 2727 -0.003921568859368563, -0.062745101749897, 2728 ], 2729 'descriptor': {shape: [3, 2], dataType: 'float32'} 2730 } 2731 } 2732 } 2733 }, 2734 { 2735 'name': 'quantized split', 2736 'graph': { 2737 'inputs': { 2738 'input': { 2739 'data': [ 2740 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2741 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 2742 ], 2743 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2744 'constant': false 2745 }, 2746 'inputScale': { 2747 'data': [0.003921568859368563], 2748 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2749 'constant': true 2750 }, 2751 'inputZeroPoint': { 2752 'data': [16], 2753 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2754 'constant': true 2755 }, 2756 'outputScale': { 2757 'data': [0.003921568859368563], 2758 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2759 'constant': true 2760 }, 2761 'outputZeroPoint': { 2762 'data': [16], 2763 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2764 'constant': true 2765 }, 2766 }, 2767 'operators': [ 2768 { 2769 'name': 'quantizeLinear', 2770 'arguments': [ 2771 {'input': 'input'}, 2772 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2773 ], 2774 'outputs': 'quantizedInput' 2775 }, 2776 { 2777 'name': 'dequantizeLinear', 2778 'arguments': [ 2779 {'input': 'quantizedInput'}, 2780 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2781 ], 2782 'outputs': 'dequantizedInput' 2783 }, 2784 { 2785 'name': 'split', 2786 'arguments': [{'input': 'dequantizedInput'}, {'splits': 3}, {'options': {'axis': 1}}], 2787 'outputs': ['splitOutput 1', 'splitOutput 2', 'splitOutput 3'], 2788 }, 2789 { 2790 'name': 'quantizeLinear', 2791 'arguments': [ 2792 {'input': 'splitOutput 1'}, 2793 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2794 ], 2795 'outputs': 'quantizedSplitOutput 1' 2796 }, 2797 { 2798 'name': 'dequantizeLinear', 2799 'arguments': [ 2800 {'input': 'quantizedSplitOutput 1'}, 2801 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2802 ], 2803 'outputs': 'output 1' 2804 }, 2805 { 2806 'name': 'quantizeLinear', 2807 'arguments': [ 2808 {'input': 'splitOutput 2'}, 2809 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2810 ], 2811 'outputs': 'quantizedSplitOutput 2' 2812 }, 2813 { 2814 'name': 'dequantizeLinear', 2815 'arguments': [ 2816 {'input': 'quantizedSplitOutput 2'}, 2817 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2818 ], 2819 'outputs': 'output 2' 2820 }, 2821 { 2822 'name': 'quantizeLinear', 2823 'arguments': [ 2824 {'input': 'splitOutput 3'}, 2825 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2826 ], 2827 'outputs': 'quantizedSplitOutput 3' 2828 }, 2829 { 2830 'name': 'dequantizeLinear', 2831 'arguments': [ 2832 {'input': 'quantizedSplitOutput 3'}, 2833 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2834 ], 2835 'outputs': 'output 3' 2836 } 2837 ], 2838 'expectedOutputs': { 2839 'output 1': { 2840 'data': [ 2841 0.43529415130615234, -0.20000001788139343, 2842 ], 2843 'descriptor': {shape: [2, 1], dataType: 'float32'} 2844 }, 2845 'output 2': { 2846 'data': [ 2847 0.0470588281750679, -0.003921568859368563, 2848 ], 2849 'descriptor': {shape: [2, 1], dataType: 'float32'} 2850 }, 2851 'output 3': { 2852 'data': [ 2853 0.3333333432674408, -0.062745101749897, 2854 ], 2855 'descriptor': {shape: [2, 1], dataType: 'float32'} 2856 } 2857 } 2858 } 2859 }, 2860 { 2861 'name': 'quantized slice', 2862 'graph': { 2863 'inputs': { 2864 'input': { 2865 'data': [ 2866 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 2867 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 2868 ], 2869 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2870 'constant': false 2871 }, 2872 'inputScale': { 2873 'data': [0.003921568859368563], 2874 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2875 'constant': true 2876 }, 2877 'inputZeroPoint': { 2878 'data': [16], 2879 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2880 'constant': true 2881 }, 2882 'outputScale': { 2883 'data': [0.003921568859368563], 2884 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2885 'constant': true 2886 }, 2887 'outputZeroPoint': { 2888 'data': [16], 2889 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2890 'constant': true 2891 }, 2892 }, 2893 'operators': [ 2894 { 2895 'name': 'quantizeLinear', 2896 'arguments': [ 2897 {'input': 'input'}, 2898 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2899 ], 2900 'outputs': 'quantizedInput' 2901 }, 2902 { 2903 'name': 'dequantizeLinear', 2904 'arguments': [ 2905 {'input': 'quantizedInput'}, 2906 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2907 ], 2908 'outputs': 'dequantizedInput' 2909 }, 2910 { 2911 'name': 'slice', 2912 'arguments': [{'input': 'dequantizedInput'}, {'starts': [0, 1]}, {'sizes': [1, 2]}], 2913 'outputs': 'sliceOutput' 2914 }, 2915 { 2916 'name': 'quantizeLinear', 2917 'arguments': [ 2918 {'input': 'sliceOutput'}, 2919 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2920 ], 2921 'outputs': 'quantizedSliceOutput' 2922 }, 2923 { 2924 'name': 'dequantizeLinear', 2925 'arguments': [ 2926 {'input': 'quantizedSliceOutput'}, 2927 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 2928 ], 2929 'outputs': 'output' 2930 } 2931 ], 2932 'expectedOutputs': { 2933 'output': { 2934 'data': [ 2935 0.0470588281750679, 0.3333333432674408, 2936 ], 2937 'descriptor': {shape: [1, 2], dataType: 'float32'} 2938 } 2939 } 2940 } 2941 }, 2942 { 2943 'name': 'quantized argMax', 2944 'graph': { 2945 'inputs': { 2946 'input': { 2947 'data': [ 2948 2.549168109893799, 4.794857501983643, 7.413617134094238, 2949 8.413617134094238, 6.108623504638672, 3.549168109893799, 2950 ], 2951 'descriptor': {shape: [2, 3], dataType: 'float32'}, 2952 'constant': false 2953 }, 2954 'inputScale': { 2955 'data': [0.343092918395996], 2956 'descriptor': {shape: [1, 1], dataType: 'float32'}, 2957 'constant': true 2958 }, 2959 'inputZeroPoint': { 2960 'data': [-128], 2961 'descriptor': {shape: [1, 1], dataType: 'int8'}, 2962 'constant': true 2963 }, 2964 'outputScale': { 2965 'data': [0.343092918395996], 2966 'descriptor': {shape: [1], dataType: 'float32'}, 2967 'constant': true 2968 }, 2969 'outputZeroPoint': { 2970 'data': [-128], 2971 'descriptor': {shape: [1], dataType: 'int8'}, 2972 'constant': true 2973 }, 2974 }, 2975 'operators': [ 2976 { 2977 'name': 'quantizeLinear', 2978 'arguments': [ 2979 {'input': 'input'}, 2980 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2981 ], 2982 'outputs': 'quantizedInput' 2983 }, 2984 { 2985 'name': 'dequantizeLinear', 2986 'arguments': [ 2987 {'input': 'quantizedInput'}, 2988 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 2989 ], 2990 'outputs': 'dequantizedInput' 2991 }, 2992 { 2993 'name': 'argMax', 2994 'arguments': [{'input': 'dequantizedInput'}, {'axis': 0}], 2995 'outputs': 'output' 2996 }, 2997 ], 2998 'expectedOutputs': { 2999 'output': { 3000 'data': [ 3001 1, 1, 0, 3002 ], 3003 'descriptor': {shape: [3], dataType: 'int32'} 3004 } 3005 } 3006 } 3007 }, 3008 { 3009 'name': 'quantized softmax', 3010 'graph': { 3011 'inputs': { 3012 'input': { 3013 'data': [ 3014 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3015 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, 3016 ], 3017 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3018 'constant': false 3019 }, 3020 'inputScale': { 3021 'data': [0.00390625], 3022 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3023 'constant': true 3024 }, 3025 'inputZeroPoint': { 3026 'data': [-128], 3027 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3028 'constant': true 3029 }, 3030 'outputScale': { 3031 'data': [0.00390625], 3032 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3033 'constant': true 3034 }, 3035 'outputZeroPoint': { 3036 'data': [-128], 3037 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3038 'constant': true 3039 }, 3040 }, 3041 'operators': [ 3042 { 3043 'name': 'quantizeLinear', 3044 'arguments': [ 3045 {'input': 'input'}, 3046 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3047 ], 3048 'outputs': 'quantizedInput' 3049 }, 3050 { 3051 'name': 'dequantizeLinear', 3052 'arguments': [ 3053 {'input': 'quantizedInput'}, 3054 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3055 ], 3056 'outputs': 'dequantizedInput' 3057 }, 3058 { 3059 'name': 'softmax', 3060 'arguments': [{'input': 'dequantizedInput'}, {'axis': 0}], 3061 'outputs': 'softmaxOutput' 3062 }, 3063 { 3064 'name': 'quantizeLinear', 3065 'arguments': [ 3066 {'input': 'softmaxOutput'}, 3067 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3068 ], 3069 'outputs': 'quantizedSoftmaxOutput' 3070 }, 3071 { 3072 'name': 'dequantizeLinear', 3073 'arguments': [ 3074 {'input': 'quantizedSoftmaxOutput'}, 3075 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3076 ], 3077 'outputs': 'output' 3078 } 3079 ], 3080 'expectedOutputs': { 3081 'output': { 3082 'data': [ 3083 0.6171875, 0.41015625, 0.5625, 3084 0.3828125, 0.58984375, 0.4375, 3085 ], 3086 'descriptor': {shape: [2, 3], dataType: 'float32'} 3087 } 3088 } 3089 } 3090 }, 3091 { 3092 'name': 'quantized reduceMax', 3093 'graph': { 3094 'inputs': { 3095 'input': { 3096 'data': [ 3097 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3098 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3099 ], 3100 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3101 'constant': false 3102 }, 3103 'inputScale': { 3104 'data': [0.003921568859368563], 3105 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3106 'constant': true 3107 }, 3108 'inputZeroPoint': { 3109 'data': [0], 3110 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3111 'constant': true 3112 }, 3113 'outputScale': { 3114 'data': [0.003921568859368563], 3115 'descriptor': {shape: [1], dataType: 'float32'}, 3116 'constant': true 3117 }, 3118 'outputZeroPoint': { 3119 'data': [0], 3120 'descriptor': {shape: [1], dataType: 'int8'}, 3121 'constant': true 3122 }, 3123 }, 3124 'operators': [ 3125 { 3126 'name': 'quantizeLinear', 3127 'arguments': [ 3128 {'input': 'input'}, 3129 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3130 ], 3131 'outputs': 'quantizedInput' 3132 }, 3133 { 3134 'name': 'dequantizeLinear', 3135 'arguments': [ 3136 {'input': 'quantizedInput'}, 3137 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3138 ], 3139 'outputs': 'dequantizedInput' 3140 }, 3141 { 3142 'name': 'reduceMax', 3143 'arguments': [{'input': 'dequantizedInput'}, {'options': {'axes': [1]}}], 3144 'outputs': 'reduceMaxOutput' 3145 }, 3146 { 3147 'name': 'quantizeLinear', 3148 'arguments': [ 3149 {'input': 'reduceMaxOutput'}, 3150 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3151 ], 3152 'outputs': 'quantizedReduceMaxOutput' 3153 }, 3154 { 3155 'name': 'dequantizeLinear', 3156 'arguments': [ 3157 {'input': 'quantizedReduceMaxOutput'}, 3158 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3159 ], 3160 'outputs': 'output' 3161 } 3162 ], 3163 'expectedOutputs': { 3164 'output': { 3165 'data': [ 3166 0.49803924560546875, -0.003921568859368563, 3167 ], 3168 'descriptor': {shape: [2], dataType: 'float32'} 3169 } 3170 } 3171 } 3172 }, 3173 { 3174 'name': 'quantized reduceMin', 3175 'graph': { 3176 'inputs': { 3177 'input': { 3178 'data': [ 3179 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3180 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3181 ], 3182 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3183 'constant': false 3184 }, 3185 'inputScale': { 3186 'data': [0.003921568859368563], 3187 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3188 'constant': true 3189 }, 3190 'inputZeroPoint': { 3191 'data': [0], 3192 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3193 'constant': true 3194 }, 3195 'outputScale': { 3196 'data': [0.003921568859368563], 3197 'descriptor': {shape: [1], dataType: 'float32'}, 3198 'constant': true 3199 }, 3200 'outputZeroPoint': { 3201 'data': [0], 3202 'descriptor': {shape: [1], dataType: 'int8'}, 3203 'constant': true 3204 }, 3205 }, 3206 'operators': [ 3207 { 3208 'name': 'quantizeLinear', 3209 'arguments': [ 3210 {'input': 'input'}, 3211 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3212 ], 3213 'outputs': 'quantizedInput' 3214 }, 3215 { 3216 'name': 'dequantizeLinear', 3217 'arguments': [ 3218 {'input': 'quantizedInput'}, 3219 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3220 ], 3221 'outputs': 'dequantizedInput' 3222 }, 3223 { 3224 'name': 'reduceMin', 3225 'arguments': [{'input': 'dequantizedInput'}, {'options': {'axes': [1]}}], 3226 'outputs': 'reduceMinOutput' 3227 }, 3228 { 3229 'name': 'quantizeLinear', 3230 'arguments': [ 3231 {'input': 'reduceMinOutput'}, 3232 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3233 ], 3234 'outputs': 'quantizedReduceMinOutput' 3235 }, 3236 { 3237 'name': 'dequantizeLinear', 3238 'arguments': [ 3239 {'input': 'quantizedReduceMinOutput'}, 3240 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3241 ], 3242 'outputs': 'output' 3243 } 3244 ], 3245 'expectedOutputs': { 3246 'output': { 3247 'data': [ 3248 0.0470588281750679, -0.20000001788139343, 3249 ], 3250 'descriptor': {shape: [2], dataType: 'float32'} 3251 } 3252 } 3253 } 3254 }, 3255 { 3256 'name': 'quantized reduceMean', 3257 'graph': { 3258 'inputs': { 3259 'input': { 3260 'data': [ 3261 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3262 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3263 ], 3264 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3265 'constant': false 3266 }, 3267 'inputScale': { 3268 'data': [0.003921568859368563], 3269 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3270 'constant': true 3271 }, 3272 'inputZeroPoint': { 3273 'data': [0], 3274 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3275 'constant': true 3276 }, 3277 'outputScale': { 3278 'data': [0.003921568859368563], 3279 'descriptor': {shape: [1], dataType: 'float32'}, 3280 'constant': true 3281 }, 3282 'outputZeroPoint': { 3283 'data': [0], 3284 'descriptor': {shape: [1], dataType: 'int8'}, 3285 'constant': true 3286 }, 3287 }, 3288 'operators': [ 3289 { 3290 'name': 'quantizeLinear', 3291 'arguments': [ 3292 {'input': 'input'}, 3293 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3294 ], 3295 'outputs': 'quantizedInput' 3296 }, 3297 { 3298 'name': 'dequantizeLinear', 3299 'arguments': [ 3300 {'input': 'quantizedInput'}, 3301 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3302 ], 3303 'outputs': 'dequantizedInput' 3304 }, 3305 { 3306 'name': 'reduceMean', 3307 'arguments': [{'input': 'dequantizedInput'}, {'options': {'axes': [1]}}], 3308 'outputs': 'reduceMeanOutput' 3309 }, 3310 { 3311 'name': 'quantizeLinear', 3312 'arguments': [ 3313 {'input': 'reduceMeanOutput'}, 3314 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3315 ], 3316 'outputs': 'quantizedReduceMeanOutput' 3317 }, 3318 { 3319 'name': 'dequantizeLinear', 3320 'arguments': [ 3321 {'input': 'quantizedReduceMeanOutput'}, 3322 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3323 ], 3324 'outputs': 'output' 3325 } 3326 ], 3327 'expectedOutputs': { 3328 'output': { 3329 'data': [ 3330 0.29411765933036804, -0.09019608050584793, 3331 ], 3332 'descriptor': {shape: [2], dataType: 'float32'} 3333 } 3334 } 3335 } 3336 }, 3337 { 3338 'name': 'quantized reduceSum', 3339 'graph': { 3340 'inputs': { 3341 'input': { 3342 'data': [ 3343 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3344 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3345 ], 3346 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3347 'constant': false 3348 }, 3349 'inputScale': { 3350 'data': [0.003921568859368563], 3351 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3352 'constant': true 3353 }, 3354 'inputZeroPoint': { 3355 'data': [0], 3356 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3357 'constant': true 3358 }, 3359 'outputScale': { 3360 'data': [0.003921568859368563], 3361 'descriptor': {shape: [1], dataType: 'float32'}, 3362 'constant': true 3363 }, 3364 'outputZeroPoint': { 3365 'data': [0], 3366 'descriptor': {shape: [1], dataType: 'int8'}, 3367 'constant': true 3368 }, 3369 }, 3370 'operators': [ 3371 { 3372 'name': 'quantizeLinear', 3373 'arguments': [ 3374 {'input': 'input'}, 3375 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3376 ], 3377 'outputs': 'quantizedInput' 3378 }, 3379 { 3380 'name': 'dequantizeLinear', 3381 'arguments': [ 3382 {'input': 'quantizedInput'}, 3383 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3384 ], 3385 'outputs': 'dequantizedInput' 3386 }, 3387 { 3388 'name': 'reduceSum', 3389 'arguments': [{'input': 'dequantizedInput'}, {'options': {'axes': [1]}}], 3390 'outputs': 'reduceSumOutput' 3391 }, 3392 { 3393 'name': 'quantizeLinear', 3394 'arguments': [ 3395 {'input': 'reduceSumOutput'}, 3396 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3397 ], 3398 'outputs': 'quantizedReduceSumOutput' 3399 }, 3400 { 3401 'name': 'dequantizeLinear', 3402 'arguments': [ 3403 {'input': 'quantizedReduceSumOutput'}, 3404 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3405 ], 3406 'outputs': 'output' 3407 } 3408 ], 3409 'expectedOutputs': { 3410 'output': { 3411 'data': [ 3412 0.49803924560546875, -0.2666666805744171, 3413 ], 3414 'descriptor': {shape: [2], dataType: 'float32'} 3415 } 3416 } 3417 } 3418 }, 3419 { 3420 'name': 'quantized resample2d', 3421 'graph': { 3422 'inputs': { 3423 'input': { 3424 'data': [ 3425 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3426 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3427 ], 3428 'descriptor': {shape: [1, 2, 3, 1], dataType: 'float32'}, 3429 'constant': false 3430 }, 3431 'inputScale': { 3432 'data': [0.003921568859368563], 3433 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 3434 'constant': true 3435 }, 3436 'inputZeroPoint': { 3437 'data': [0], 3438 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 3439 'constant': true 3440 }, 3441 'outputScale': { 3442 'data': [0.003921568859368563], 3443 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}, 3444 'constant': true 3445 }, 3446 'outputZeroPoint': { 3447 'data': [0], 3448 'descriptor': {shape: [1, 1, 1, 1], dataType: 'int8'}, 3449 'constant': true 3450 }, 3451 }, 3452 'operators': [ 3453 { 3454 'name': 'quantizeLinear', 3455 'arguments': [ 3456 {'input': 'input'}, 3457 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3458 ], 3459 'outputs': 'quantizedInput' 3460 }, 3461 { 3462 'name': 'dequantizeLinear', 3463 'arguments': [ 3464 {'input': 'quantizedInput'}, 3465 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3466 ], 3467 'outputs': 'dequantizedInput' 3468 }, 3469 { 3470 'name': 'resample2d', 3471 'arguments': [{'input': 'dequantizedInput'}, {'options': {'sizes': [4, 6], 'axes': [1, 2]}}], 3472 'outputs': 'resample2dOutput' 3473 }, 3474 { 3475 'name': 'quantizeLinear', 3476 'arguments': [ 3477 {'input': 'resample2dOutput'}, 3478 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3479 ], 3480 'outputs': 'quantizedResample2dOutput' 3481 }, 3482 { 3483 'name': 'dequantizeLinear', 3484 'arguments': [ 3485 {'input': 'quantizedResample2dOutput'}, 3486 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3487 ], 3488 'outputs': 'output' 3489 } 3490 ], 3491 'expectedOutputs': { 3492 'output': { 3493 'data': [ 3494 0.49803924560546875, 0.49803924560546875, 0.0470588281750679, 3495 0.0470588281750679, 0.3333333432674408, 0.3333333432674408, 3496 0.49803924560546875, 0.49803924560546875, 0.0470588281750679, 3497 0.0470588281750679, 0.3333333432674408, 0.3333333432674408, 3498 -0.20000001788139343, -0.20000001788139343, -0.003921568859368563, 3499 -0.003921568859368563, -0.062745101749897, -0.062745101749897, 3500 -0.20000001788139343, -0.20000001788139343, -0.003921568859368563, 3501 -0.003921568859368563, -0.062745101749897, -0.062745101749897, 3502 ], 3503 'descriptor': {shape: [1, 4, 6, 1], dataType: 'float32'} 3504 } 3505 } 3506 } 3507 }, 3508 { 3509 'name': 'quantized pad with reflection mode', 3510 'graph': { 3511 'inputs': { 3512 'input': { 3513 'data': [ 3514 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3515 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3516 ], 3517 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3518 'constant': false 3519 }, 3520 'inputScale': { 3521 'data': [0.003921568859368563], 3522 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3523 'constant': true 3524 }, 3525 'inputZeroPoint': { 3526 'data': [0], 3527 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3528 'constant': true 3529 }, 3530 'outputScale': { 3531 'data': [0.003921568859368563], 3532 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3533 'constant': true 3534 }, 3535 'outputZeroPoint': { 3536 'data': [0], 3537 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3538 'constant': true 3539 }, 3540 }, 3541 'operators': [ 3542 { 3543 'name': 'quantizeLinear', 3544 'arguments': [ 3545 {'input': 'input'}, 3546 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3547 ], 3548 'outputs': 'quantizedInput' 3549 }, 3550 { 3551 'name': 'dequantizeLinear', 3552 'arguments': [ 3553 {'input': 'quantizedInput'}, 3554 {'scale': 'inputScale', 'zeroPoint': 'inputZeroPoint'} 3555 ], 3556 'outputs': 'dequantizedInput' 3557 }, 3558 { 3559 'name': 'pad', 3560 'arguments': [ 3561 {'input': 'dequantizedInput'}, {'beginningPadding': [1, 2]}, 3562 {'endingPadding': [1, 2]}, {'options': {'mode': 'reflection'}} 3563 ], 3564 'outputs': 'padOutput' 3565 }, 3566 { 3567 'name': 'quantizeLinear', 3568 'arguments': [ 3569 {'input': 'padOutput'}, 3570 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3571 ], 3572 'outputs': 'quantizedPadOutput' 3573 }, 3574 { 3575 'name': 'dequantizeLinear', 3576 'arguments': [ 3577 {'input': 'quantizedPadOutput'}, 3578 {'scale': 'outputScale', 'zeroPoint': 'outputZeroPoint'} 3579 ], 3580 'outputs': 'output' 3581 } 3582 ], 3583 'expectedOutputs': { 3584 'output': { 3585 'data': [ 3586 -0.062745101749897, -0.003921568859368563, -0.20000001788139343, 3587 -0.003921568859368563, -0.062745101749897, -0.003921568859368563, 3588 -0.20000001788139343, 0.3333333432674408, 0.0470588281750679, 3589 0.49803924560546875, 0.0470588281750679, 0.3333333432674408, 3590 0.0470588281750679, 0.49803924560546875, -0.062745101749897, 3591 -0.003921568859368563, -0.20000001788139343, -0.003921568859368563, 3592 -0.062745101749897, -0.003921568859368563, -0.20000001788139343, 3593 0.3333333432674408, 0.0470588281750679, 0.49803924560546875, 3594 0.0470588281750679, 0.3333333432674408, 0.0470588281750679, 3595 0.49803924560546875, 3596 ], 3597 'descriptor': {shape: [4, 7], dataType: 'float32'} 3598 } 3599 } 3600 } 3601 }, 3602 { 3603 'name': 'quantized pad with constant mode for Kernel fusion', 3604 'graph': { 3605 'inputs': { 3606 'input': { 3607 'data': [ 3608 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3609 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3610 ], 3611 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3612 'constant': false 3613 }, 3614 'scale': { 3615 'data': [0.003921568859368563], 3616 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3617 'constant': true 3618 }, 3619 'zeroPoint': { 3620 'data': [0], 3621 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3622 'constant': true 3623 }, 3624 }, 3625 'operators': [ 3626 { 3627 'name': 'quantizeLinear', 3628 'arguments': [ 3629 {'input': 'input'}, 3630 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3631 ], 3632 'outputs': 'quantizedInput' 3633 }, 3634 { 3635 'name': 'dequantizeLinear', 3636 'arguments': [ 3637 {'input': 'quantizedInput'}, 3638 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3639 ], 3640 'outputs': 'dequantizedInput' 3641 }, 3642 { 3643 'name': 'pad', 3644 'arguments': [ 3645 {'input': 'dequantizedInput'}, {'beginningPadding': [1, 2]}, 3646 {'endingPadding': [1, 2]}, {'options': {'value': 1}} 3647 ], 3648 'outputs': 'padOutput' 3649 }, 3650 { 3651 'name': 'quantizeLinear', 3652 'arguments': [ 3653 {'input': 'padOutput'}, 3654 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3655 ], 3656 'outputs': 'quantizedPadOutput' 3657 }, 3658 { 3659 'name': 'dequantizeLinear', 3660 'arguments': [ 3661 {'input': 'quantizedPadOutput'}, 3662 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3663 ], 3664 'outputs': 'output' 3665 } 3666 ], 3667 'expectedOutputs': { 3668 'output': { 3669 'data': [ 3670 0.49803924560546875, 0.49803924560546875, 0.49803924560546875, 3671 0.49803924560546875, 0.49803924560546875, 0.49803924560546875, 3672 0.49803924560546875, 0.49803924560546875, 0.49803924560546875, 3673 0.49803924560546875, 0.0470588281750679, 0.3333333432674408, 3674 0.49803924560546875, 0.49803924560546875, 0.49803924560546875, 3675 0.49803924560546875, -0.20000001788139343, -0.003921568859368563, 3676 -0.062745101749897, 0.49803924560546875, 0.49803924560546875, 3677 0.49803924560546875, 0.49803924560546875, 0.49803924560546875, 3678 0.49803924560546875, 0.49803924560546875, 0.49803924560546875, 3679 0.49803924560546875, 3680 ], 3681 'descriptor': {shape: [4, 7], dataType: 'float32'} 3682 } 3683 } 3684 } 3685 }, 3686 { 3687 'name': 'quantized pad with constant mode for XNNPack fusion', 3688 'graph': { 3689 'inputs': { 3690 'input': { 3691 'data': [ 3692 1.6811466217041016, 0.0479511022567749, 0.33355462551116943, 3693 -0.1988269537687301, -0.0041167140007019, -0.0634240251779556, 3694 ], 3695 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3696 'constant': false 3697 }, 3698 'scale': { 3699 'data': [0.003921568859368563], 3700 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3701 'constant': true 3702 }, 3703 'zeroPoint': { 3704 'data': [0], 3705 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3706 'constant': true 3707 }, 3708 }, 3709 'operators': [ 3710 { 3711 'name': 'quantizeLinear', 3712 'arguments': [ 3713 {'input': 'input'}, 3714 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3715 ], 3716 'outputs': 'quantizedInput' 3717 }, 3718 { 3719 'name': 'dequantizeLinear', 3720 'arguments': [ 3721 {'input': 'quantizedInput'}, 3722 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3723 ], 3724 'outputs': 'dequantizedInput' 3725 }, 3726 { 3727 'name': 'pad', 3728 'arguments': [ 3729 {'input': 'dequantizedInput'}, {'beginningPadding': [1, 2]}, 3730 {'endingPadding': [1, 2]}, {'options': {'value': 0}} 3731 ], 3732 'outputs': 'padOutput' 3733 }, 3734 { 3735 'name': 'quantizeLinear', 3736 'arguments': [ 3737 {'input': 'padOutput'}, 3738 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3739 ], 3740 'outputs': 'quantizedPadOutput' 3741 }, 3742 { 3743 'name': 'dequantizeLinear', 3744 'arguments': [ 3745 {'input': 'quantizedPadOutput'}, 3746 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3747 ], 3748 'outputs': 'output' 3749 } 3750 ], 3751 'expectedOutputs': { 3752 'output': { 3753 'data': [ 3754 0, 0, 0, 0, 3755 0, 0, 0, 0, 3756 0, 0.49803924560546875, 0.0470588281750679, 0.3333333432674408, 3757 0, 0, 0, 0, 3758 -0.20000001788139343, -0.003921568859368563, -0.062745101749897, 0, 3759 0, 0, 0, 0, 3760 0, 0, 0, 0, 3761 ], 3762 'descriptor': {shape: [4, 7], dataType: 'float32'} 3763 } 3764 } 3765 } 3766 }, 3767 { 3768 'name': 'quantized clamp', 3769 'graph': { 3770 'inputs': { 3771 'input': { 3772 'data': [ 3773 8.413617134094238, 6.108623504638672, 3.549168109893799, 3774 1.6811466217041016, -0.1988269537687301, -8.413617134094238, 3775 ], 3776 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3777 'constant': false 3778 }, 3779 'scale': { 3780 'data': [0.343092918395996], 3781 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3782 'constant': true 3783 }, 3784 'zeroPoint': { 3785 'data': [0], 3786 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3787 'constant': true 3788 }, 3789 }, 3790 'operators': [ 3791 { 3792 'name': 'quantizeLinear', 3793 'arguments': [ 3794 {'input': 'input'}, 3795 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3796 ], 3797 'outputs': 'quantizedInput' 3798 }, 3799 { 3800 'name': 'dequantizeLinear', 3801 'arguments': [ 3802 {'input': 'quantizedInput'}, 3803 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3804 ], 3805 'outputs': 'dequantizedInput' 3806 }, 3807 { 3808 'name': 'clamp', 3809 'arguments': [ 3810 {'input': 'dequantizedInput'}, 3811 {'options': {'minValue': 0, 'maxValue': 6}} 3812 ], 3813 'outputs': 'clampOutput' 3814 }, 3815 { 3816 'name': 'quantizeLinear', 3817 'arguments': [ 3818 {'input': 'clampOutput'}, 3819 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3820 ], 3821 'outputs': 'quantizedClampOutput' 3822 }, 3823 { 3824 'name': 'dequantizeLinear', 3825 'arguments': [ 3826 {'input': 'quantizedClampOutput'}, 3827 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3828 ], 3829 'outputs': 'output' 3830 } 3831 ], 3832 'expectedOutputs': { 3833 'output': { 3834 'data': [ 3835 5.832579612731934, 5.832579612731934, 3.430929183959961, 3836 1.7154645919799805, 0, 0, 3837 ], 3838 'descriptor': {shape: [2, 3], dataType: 'float32'} 3839 } 3840 } 3841 } 3842 }, 3843 { 3844 'name': 'quantized clamp with emulation', 3845 'graph': { 3846 'inputs': { 3847 'input': { 3848 'data': [ 3849 8.413617134094238, 6.108623504638672, 3.549168109893799, 3850 1.6811466217041016, -0.1988269537687301, -8.413617134094238, 3851 ], 3852 'descriptor': {shape: [2, 3], dataType: 'float32'}, 3853 'constant': false 3854 }, 3855 'scale': { 3856 'data': [0.343092918395996], 3857 'descriptor': {shape: [1, 1], dataType: 'float32'}, 3858 'constant': true 3859 }, 3860 'zeroPoint': { 3861 'data': [0], 3862 'descriptor': {shape: [1, 1], dataType: 'int8'}, 3863 'constant': true 3864 }, 3865 }, 3866 'operators': [ 3867 { 3868 'name': 'quantizeLinear', 3869 'arguments': [ 3870 {'input': 'input'}, 3871 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3872 ], 3873 'outputs': 'quantizedInput' 3874 }, 3875 { 3876 'name': 'dequantizeLinear', 3877 'arguments': [ 3878 {'input': 'quantizedInput'}, 3879 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3880 ], 3881 'outputs': 'dequantizedInput' 3882 }, 3883 { 3884 'name': 'clamp', 3885 'arguments': [ 3886 {'input': 'dequantizedInput'}, 3887 {'options': {'minValue': -8, 'maxValue': 8}} 3888 ], 3889 'outputs': 'clampOutput' 3890 }, 3891 { 3892 'name': 'quantizeLinear', 3893 'arguments': [ 3894 {'input': 'clampOutput'}, 3895 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3896 ], 3897 'outputs': 'quantizedClampOutput' 3898 }, 3899 { 3900 'name': 'dequantizeLinear', 3901 'arguments': [ 3902 {'input': 'quantizedClampOutput'}, 3903 {'scale': 'scale', 'zeroPoint': 'zeroPoint'} 3904 ], 3905 'outputs': 'output' 3906 } 3907 ], 3908 'expectedOutputs': { 3909 'output': { 3910 'data': [ 3911 7.89113712310791, 6.17567253112793, 3.430929183959961, 3912 1.7154645919799805, -0.3430929183959961, -7.89113712310791, 3913 ], 3914 'descriptor': {shape: [2, 3], dataType: 'float32'} 3915 } 3916 } 3917 } 3918 }, 3919 ]; 3920 3921 webnn_conformance_test( 3922 subgraphTests, buildAndExecuteGraph, getPrecisionTolerance);