1 // clang-format off 2 // Generated file (from: quantize.mod.py). Do not edit 3 // Create the model 4 Model createTestModel_quant8() { 5 const std::vector<Operand> operands = { 6 { 7 .type = OperandType::TENSOR_FLOAT32, 8 .dimensions = {300}, 9 .numberOfConsumers = 1, 10 .scale = 0.0f, 11 .zeroPoint = 0, 12 .lifetime = OperandLifeTime::MODEL_INPUT, 13 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 14 }, 15 { 16 .type = OperandType::TENSOR_QUANT8_ASYMM, 17 .dimensions = {300}, 18 .numberOfConsumers = 0, 19 .scale = 1.0f, 20 .zeroPoint = 0, 21 .lifetime = OperandLifeTime::MODEL_OUTPUT, 22 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 23 } 24 }; 25 26 const std::vector<Operation> operations = { 27 { 28 .type = OperationType::QUANTIZE, 29 .inputs = {0}, 30 .outputs = {1}, 31 } 32 }; 33 34 const std::vector<uint32_t> inputIndexes = {0}; 35 const std::vector<uint32_t> outputIndexes = {1}; 36 std::vector<uint8_t> operandValues = {}; 37 const std::vector<hidl_memory> pools = {}; 38 39 return { 40 .operands = operands, 41 .operations = operations, 42 .inputIndexes = inputIndexes, 43 .outputIndexes = outputIndexes, 44 .operandValues = operandValues, 45 .pools = pools, 46 }; 47 } 48 49 inline bool is_ignored_quant8(int i) { 50 static std::set<int> ignore = {}; 51 return ignore.find(i) != ignore.end(); 52 } 53 54 // Create the model 55 Model createTestModel_dynamic_output_shape_quant8() { 56 const std::vector<Operand> operands = { 57 { 58 .type = OperandType::TENSOR_FLOAT32, 59 .dimensions = {300}, 60 .numberOfConsumers = 1, 61 .scale = 0.0f, 62 .zeroPoint = 0, 63 .lifetime = OperandLifeTime::MODEL_INPUT, 64 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 65 }, 66 { 67 .type = OperandType::TENSOR_QUANT8_ASYMM, 68 .dimensions = {0}, 69 .numberOfConsumers = 0, 70 .scale = 1.0f, 71 .zeroPoint = 0, 72 .lifetime = OperandLifeTime::MODEL_OUTPUT, 73 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 74 } 75 }; 76 77 const std::vector<Operation> operations = { 78 { 79 .type = OperationType::QUANTIZE, 80 .inputs = {0}, 81 .outputs = {1}, 82 } 83 }; 84 85 const std::vector<uint32_t> inputIndexes = {0}; 86 const std::vector<uint32_t> outputIndexes = {1}; 87 std::vector<uint8_t> operandValues = {}; 88 const std::vector<hidl_memory> pools = {}; 89 90 return { 91 .operands = operands, 92 .operations = operations, 93 .inputIndexes = inputIndexes, 94 .outputIndexes = outputIndexes, 95 .operandValues = operandValues, 96 .pools = pools, 97 }; 98 } 99 100 inline bool is_ignored_dynamic_output_shape_quant8(int i) { 101 static std::set<int> ignore = {}; 102 return ignore.find(i) != ignore.end(); 103 } 104 105 // Create the model 106 Model createTestModel_quant8_2() { 107 const std::vector<Operand> operands = { 108 { 109 .type = OperandType::TENSOR_FLOAT32, 110 .dimensions = {300}, 111 .numberOfConsumers = 1, 112 .scale = 0.0f, 113 .zeroPoint = 0, 114 .lifetime = OperandLifeTime::MODEL_INPUT, 115 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 116 }, 117 { 118 .type = OperandType::TENSOR_QUANT8_ASYMM, 119 .dimensions = {300}, 120 .numberOfConsumers = 0, 121 .scale = 1.0f, 122 .zeroPoint = 1, 123 .lifetime = OperandLifeTime::MODEL_OUTPUT, 124 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 125 } 126 }; 127 128 const std::vector<Operation> operations = { 129 { 130 .type = OperationType::QUANTIZE, 131 .inputs = {0}, 132 .outputs = {1}, 133 } 134 }; 135 136 const std::vector<uint32_t> inputIndexes = {0}; 137 const std::vector<uint32_t> outputIndexes = {1}; 138 std::vector<uint8_t> operandValues = {}; 139 const std::vector<hidl_memory> pools = {}; 140 141 return { 142 .operands = operands, 143 .operations = operations, 144 .inputIndexes = inputIndexes, 145 .outputIndexes = outputIndexes, 146 .operandValues = operandValues, 147 .pools = pools, 148 }; 149 } 150 151 inline bool is_ignored_quant8_2(int i) { 152 static std::set<int> ignore = {}; 153 return ignore.find(i) != ignore.end(); 154 } 155 156 // Create the model 157 Model createTestModel_dynamic_output_shape_quant8_2() { 158 const std::vector<Operand> operands = { 159 { 160 .type = OperandType::TENSOR_FLOAT32, 161 .dimensions = {300}, 162 .numberOfConsumers = 1, 163 .scale = 0.0f, 164 .zeroPoint = 0, 165 .lifetime = OperandLifeTime::MODEL_INPUT, 166 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 167 }, 168 { 169 .type = OperandType::TENSOR_QUANT8_ASYMM, 170 .dimensions = {0}, 171 .numberOfConsumers = 0, 172 .scale = 1.0f, 173 .zeroPoint = 1, 174 .lifetime = OperandLifeTime::MODEL_OUTPUT, 175 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 176 } 177 }; 178 179 const std::vector<Operation> operations = { 180 { 181 .type = OperationType::QUANTIZE, 182 .inputs = {0}, 183 .outputs = {1}, 184 } 185 }; 186 187 const std::vector<uint32_t> inputIndexes = {0}; 188 const std::vector<uint32_t> outputIndexes = {1}; 189 std::vector<uint8_t> operandValues = {}; 190 const std::vector<hidl_memory> pools = {}; 191 192 return { 193 .operands = operands, 194 .operations = operations, 195 .inputIndexes = inputIndexes, 196 .outputIndexes = outputIndexes, 197 .operandValues = operandValues, 198 .pools = pools, 199 }; 200 } 201 202 inline bool is_ignored_dynamic_output_shape_quant8_2(int i) { 203 static std::set<int> ignore = {}; 204 return ignore.find(i) != ignore.end(); 205 } 206 207 // Create the model 208 Model createTestModel_quant8_3() { 209 const std::vector<Operand> operands = { 210 { 211 .type = OperandType::TENSOR_FLOAT32, 212 .dimensions = {300}, 213 .numberOfConsumers = 1, 214 .scale = 0.0f, 215 .zeroPoint = 0, 216 .lifetime = OperandLifeTime::MODEL_INPUT, 217 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 218 }, 219 { 220 .type = OperandType::TENSOR_QUANT8_ASYMM, 221 .dimensions = {300}, 222 .numberOfConsumers = 0, 223 .scale = 0.01f, 224 .zeroPoint = 120, 225 .lifetime = OperandLifeTime::MODEL_OUTPUT, 226 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 227 } 228 }; 229 230 const std::vector<Operation> operations = { 231 { 232 .type = OperationType::QUANTIZE, 233 .inputs = {0}, 234 .outputs = {1}, 235 } 236 }; 237 238 const std::vector<uint32_t> inputIndexes = {0}; 239 const std::vector<uint32_t> outputIndexes = {1}; 240 std::vector<uint8_t> operandValues = {}; 241 const std::vector<hidl_memory> pools = {}; 242 243 return { 244 .operands = operands, 245 .operations = operations, 246 .inputIndexes = inputIndexes, 247 .outputIndexes = outputIndexes, 248 .operandValues = operandValues, 249 .pools = pools, 250 }; 251 } 252 253 inline bool is_ignored_quant8_3(int i) { 254 static std::set<int> ignore = {}; 255 return ignore.find(i) != ignore.end(); 256 } 257 258 // Create the model 259 Model createTestModel_dynamic_output_shape_quant8_3() { 260 const std::vector<Operand> operands = { 261 { 262 .type = OperandType::TENSOR_FLOAT32, 263 .dimensions = {300}, 264 .numberOfConsumers = 1, 265 .scale = 0.0f, 266 .zeroPoint = 0, 267 .lifetime = OperandLifeTime::MODEL_INPUT, 268 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 269 }, 270 { 271 .type = OperandType::TENSOR_QUANT8_ASYMM, 272 .dimensions = {0}, 273 .numberOfConsumers = 0, 274 .scale = 0.01f, 275 .zeroPoint = 120, 276 .lifetime = OperandLifeTime::MODEL_OUTPUT, 277 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 278 } 279 }; 280 281 const std::vector<Operation> operations = { 282 { 283 .type = OperationType::QUANTIZE, 284 .inputs = {0}, 285 .outputs = {1}, 286 } 287 }; 288 289 const std::vector<uint32_t> inputIndexes = {0}; 290 const std::vector<uint32_t> outputIndexes = {1}; 291 std::vector<uint8_t> operandValues = {}; 292 const std::vector<hidl_memory> pools = {}; 293 294 return { 295 .operands = operands, 296 .operations = operations, 297 .inputIndexes = inputIndexes, 298 .outputIndexes = outputIndexes, 299 .operandValues = operandValues, 300 .pools = pools, 301 }; 302 } 303 304 inline bool is_ignored_dynamic_output_shape_quant8_3(int i) { 305 static std::set<int> ignore = {}; 306 return ignore.find(i) != ignore.end(); 307 } 308 309 // Create the model 310 Model createTestModel_quant8_4() { 311 const std::vector<Operand> operands = { 312 { 313 .type = OperandType::TENSOR_FLOAT32, 314 .dimensions = {300}, 315 .numberOfConsumers = 1, 316 .scale = 0.0f, 317 .zeroPoint = 0, 318 .lifetime = OperandLifeTime::MODEL_INPUT, 319 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 320 }, 321 { 322 .type = OperandType::TENSOR_QUANT8_ASYMM, 323 .dimensions = {300}, 324 .numberOfConsumers = 0, 325 .scale = 10.0f, 326 .zeroPoint = 120, 327 .lifetime = OperandLifeTime::MODEL_OUTPUT, 328 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 329 } 330 }; 331 332 const std::vector<Operation> operations = { 333 { 334 .type = OperationType::QUANTIZE, 335 .inputs = {0}, 336 .outputs = {1}, 337 } 338 }; 339 340 const std::vector<uint32_t> inputIndexes = {0}; 341 const std::vector<uint32_t> outputIndexes = {1}; 342 std::vector<uint8_t> operandValues = {}; 343 const std::vector<hidl_memory> pools = {}; 344 345 return { 346 .operands = operands, 347 .operations = operations, 348 .inputIndexes = inputIndexes, 349 .outputIndexes = outputIndexes, 350 .operandValues = operandValues, 351 .pools = pools, 352 }; 353 } 354 355 inline bool is_ignored_quant8_4(int i) { 356 static std::set<int> ignore = {}; 357 return ignore.find(i) != ignore.end(); 358 } 359 360 // Create the model 361 Model createTestModel_dynamic_output_shape_quant8_4() { 362 const std::vector<Operand> operands = { 363 { 364 .type = OperandType::TENSOR_FLOAT32, 365 .dimensions = {300}, 366 .numberOfConsumers = 1, 367 .scale = 0.0f, 368 .zeroPoint = 0, 369 .lifetime = OperandLifeTime::MODEL_INPUT, 370 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 371 }, 372 { 373 .type = OperandType::TENSOR_QUANT8_ASYMM, 374 .dimensions = {0}, 375 .numberOfConsumers = 0, 376 .scale = 10.0f, 377 .zeroPoint = 120, 378 .lifetime = OperandLifeTime::MODEL_OUTPUT, 379 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 380 } 381 }; 382 383 const std::vector<Operation> operations = { 384 { 385 .type = OperationType::QUANTIZE, 386 .inputs = {0}, 387 .outputs = {1}, 388 } 389 }; 390 391 const std::vector<uint32_t> inputIndexes = {0}; 392 const std::vector<uint32_t> outputIndexes = {1}; 393 std::vector<uint8_t> operandValues = {}; 394 const std::vector<hidl_memory> pools = {}; 395 396 return { 397 .operands = operands, 398 .operations = operations, 399 .inputIndexes = inputIndexes, 400 .outputIndexes = outputIndexes, 401 .operandValues = operandValues, 402 .pools = pools, 403 }; 404 } 405 406 inline bool is_ignored_dynamic_output_shape_quant8_4(int i) { 407 static std::set<int> ignore = {}; 408 return ignore.find(i) != ignore.end(); 409 } 410 411 // Create the model 412 Model createTestModel_quant8_5() { 413 const std::vector<Operand> operands = { 414 { 415 .type = OperandType::TENSOR_FLOAT16, 416 .dimensions = {300}, 417 .numberOfConsumers = 1, 418 .scale = 0.0f, 419 .zeroPoint = 0, 420 .lifetime = OperandLifeTime::MODEL_INPUT, 421 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 422 }, 423 { 424 .type = OperandType::TENSOR_QUANT8_ASYMM, 425 .dimensions = {300}, 426 .numberOfConsumers = 0, 427 .scale = 1.0f, 428 .zeroPoint = 0, 429 .lifetime = OperandLifeTime::MODEL_OUTPUT, 430 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 431 } 432 }; 433 434 const std::vector<Operation> operations = { 435 { 436 .type = OperationType::QUANTIZE, 437 .inputs = {0}, 438 .outputs = {1}, 439 } 440 }; 441 442 const std::vector<uint32_t> inputIndexes = {0}; 443 const std::vector<uint32_t> outputIndexes = {1}; 444 std::vector<uint8_t> operandValues = {}; 445 const std::vector<hidl_memory> pools = {}; 446 447 return { 448 .operands = operands, 449 .operations = operations, 450 .inputIndexes = inputIndexes, 451 .outputIndexes = outputIndexes, 452 .operandValues = operandValues, 453 .pools = pools, 454 }; 455 } 456 457 inline bool is_ignored_quant8_5(int i) { 458 static std::set<int> ignore = {}; 459 return ignore.find(i) != ignore.end(); 460 } 461 462 // Create the model 463 Model createTestModel_dynamic_output_shape_quant8_5() { 464 const std::vector<Operand> operands = { 465 { 466 .type = OperandType::TENSOR_FLOAT16, 467 .dimensions = {300}, 468 .numberOfConsumers = 1, 469 .scale = 0.0f, 470 .zeroPoint = 0, 471 .lifetime = OperandLifeTime::MODEL_INPUT, 472 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 473 }, 474 { 475 .type = OperandType::TENSOR_QUANT8_ASYMM, 476 .dimensions = {0}, 477 .numberOfConsumers = 0, 478 .scale = 1.0f, 479 .zeroPoint = 0, 480 .lifetime = OperandLifeTime::MODEL_OUTPUT, 481 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 482 } 483 }; 484 485 const std::vector<Operation> operations = { 486 { 487 .type = OperationType::QUANTIZE, 488 .inputs = {0}, 489 .outputs = {1}, 490 } 491 }; 492 493 const std::vector<uint32_t> inputIndexes = {0}; 494 const std::vector<uint32_t> outputIndexes = {1}; 495 std::vector<uint8_t> operandValues = {}; 496 const std::vector<hidl_memory> pools = {}; 497 498 return { 499 .operands = operands, 500 .operations = operations, 501 .inputIndexes = inputIndexes, 502 .outputIndexes = outputIndexes, 503 .operandValues = operandValues, 504 .pools = pools, 505 }; 506 } 507 508 inline bool is_ignored_dynamic_output_shape_quant8_5(int i) { 509 static std::set<int> ignore = {}; 510 return ignore.find(i) != ignore.end(); 511 } 512 513 // Create the model 514 Model createTestModel_quant8_6() { 515 const std::vector<Operand> operands = { 516 { 517 .type = OperandType::TENSOR_FLOAT16, 518 .dimensions = {300}, 519 .numberOfConsumers = 1, 520 .scale = 0.0f, 521 .zeroPoint = 0, 522 .lifetime = OperandLifeTime::MODEL_INPUT, 523 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 524 }, 525 { 526 .type = OperandType::TENSOR_QUANT8_ASYMM, 527 .dimensions = {300}, 528 .numberOfConsumers = 0, 529 .scale = 1.0f, 530 .zeroPoint = 1, 531 .lifetime = OperandLifeTime::MODEL_OUTPUT, 532 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 533 } 534 }; 535 536 const std::vector<Operation> operations = { 537 { 538 .type = OperationType::QUANTIZE, 539 .inputs = {0}, 540 .outputs = {1}, 541 } 542 }; 543 544 const std::vector<uint32_t> inputIndexes = {0}; 545 const std::vector<uint32_t> outputIndexes = {1}; 546 std::vector<uint8_t> operandValues = {}; 547 const std::vector<hidl_memory> pools = {}; 548 549 return { 550 .operands = operands, 551 .operations = operations, 552 .inputIndexes = inputIndexes, 553 .outputIndexes = outputIndexes, 554 .operandValues = operandValues, 555 .pools = pools, 556 }; 557 } 558 559 inline bool is_ignored_quant8_6(int i) { 560 static std::set<int> ignore = {}; 561 return ignore.find(i) != ignore.end(); 562 } 563 564 // Create the model 565 Model createTestModel_dynamic_output_shape_quant8_6() { 566 const std::vector<Operand> operands = { 567 { 568 .type = OperandType::TENSOR_FLOAT16, 569 .dimensions = {300}, 570 .numberOfConsumers = 1, 571 .scale = 0.0f, 572 .zeroPoint = 0, 573 .lifetime = OperandLifeTime::MODEL_INPUT, 574 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 575 }, 576 { 577 .type = OperandType::TENSOR_QUANT8_ASYMM, 578 .dimensions = {0}, 579 .numberOfConsumers = 0, 580 .scale = 1.0f, 581 .zeroPoint = 1, 582 .lifetime = OperandLifeTime::MODEL_OUTPUT, 583 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 584 } 585 }; 586 587 const std::vector<Operation> operations = { 588 { 589 .type = OperationType::QUANTIZE, 590 .inputs = {0}, 591 .outputs = {1}, 592 } 593 }; 594 595 const std::vector<uint32_t> inputIndexes = {0}; 596 const std::vector<uint32_t> outputIndexes = {1}; 597 std::vector<uint8_t> operandValues = {}; 598 const std::vector<hidl_memory> pools = {}; 599 600 return { 601 .operands = operands, 602 .operations = operations, 603 .inputIndexes = inputIndexes, 604 .outputIndexes = outputIndexes, 605 .operandValues = operandValues, 606 .pools = pools, 607 }; 608 } 609 610 inline bool is_ignored_dynamic_output_shape_quant8_6(int i) { 611 static std::set<int> ignore = {}; 612 return ignore.find(i) != ignore.end(); 613 } 614 615 // Create the model 616 Model createTestModel_quant8_7() { 617 const std::vector<Operand> operands = { 618 { 619 .type = OperandType::TENSOR_FLOAT16, 620 .dimensions = {300}, 621 .numberOfConsumers = 1, 622 .scale = 0.0f, 623 .zeroPoint = 0, 624 .lifetime = OperandLifeTime::MODEL_INPUT, 625 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 626 }, 627 { 628 .type = OperandType::TENSOR_QUANT8_ASYMM, 629 .dimensions = {300}, 630 .numberOfConsumers = 0, 631 .scale = 0.01f, 632 .zeroPoint = 120, 633 .lifetime = OperandLifeTime::MODEL_OUTPUT, 634 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 635 } 636 }; 637 638 const std::vector<Operation> operations = { 639 { 640 .type = OperationType::QUANTIZE, 641 .inputs = {0}, 642 .outputs = {1}, 643 } 644 }; 645 646 const std::vector<uint32_t> inputIndexes = {0}; 647 const std::vector<uint32_t> outputIndexes = {1}; 648 std::vector<uint8_t> operandValues = {}; 649 const std::vector<hidl_memory> pools = {}; 650 651 return { 652 .operands = operands, 653 .operations = operations, 654 .inputIndexes = inputIndexes, 655 .outputIndexes = outputIndexes, 656 .operandValues = operandValues, 657 .pools = pools, 658 }; 659 } 660 661 inline bool is_ignored_quant8_7(int i) { 662 static std::set<int> ignore = {}; 663 return ignore.find(i) != ignore.end(); 664 } 665 666 // Create the model 667 Model createTestModel_dynamic_output_shape_quant8_7() { 668 const std::vector<Operand> operands = { 669 { 670 .type = OperandType::TENSOR_FLOAT16, 671 .dimensions = {300}, 672 .numberOfConsumers = 1, 673 .scale = 0.0f, 674 .zeroPoint = 0, 675 .lifetime = OperandLifeTime::MODEL_INPUT, 676 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 677 }, 678 { 679 .type = OperandType::TENSOR_QUANT8_ASYMM, 680 .dimensions = {0}, 681 .numberOfConsumers = 0, 682 .scale = 0.01f, 683 .zeroPoint = 120, 684 .lifetime = OperandLifeTime::MODEL_OUTPUT, 685 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 686 } 687 }; 688 689 const std::vector<Operation> operations = { 690 { 691 .type = OperationType::QUANTIZE, 692 .inputs = {0}, 693 .outputs = {1}, 694 } 695 }; 696 697 const std::vector<uint32_t> inputIndexes = {0}; 698 const std::vector<uint32_t> outputIndexes = {1}; 699 std::vector<uint8_t> operandValues = {}; 700 const std::vector<hidl_memory> pools = {}; 701 702 return { 703 .operands = operands, 704 .operations = operations, 705 .inputIndexes = inputIndexes, 706 .outputIndexes = outputIndexes, 707 .operandValues = operandValues, 708 .pools = pools, 709 }; 710 } 711 712 inline bool is_ignored_dynamic_output_shape_quant8_7(int i) { 713 static std::set<int> ignore = {}; 714 return ignore.find(i) != ignore.end(); 715 } 716 717 // Create the model 718 Model createTestModel_quant8_8() { 719 const std::vector<Operand> operands = { 720 { 721 .type = OperandType::TENSOR_FLOAT16, 722 .dimensions = {300}, 723 .numberOfConsumers = 1, 724 .scale = 0.0f, 725 .zeroPoint = 0, 726 .lifetime = OperandLifeTime::MODEL_INPUT, 727 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 728 }, 729 { 730 .type = OperandType::TENSOR_QUANT8_ASYMM, 731 .dimensions = {300}, 732 .numberOfConsumers = 0, 733 .scale = 10.0f, 734 .zeroPoint = 120, 735 .lifetime = OperandLifeTime::MODEL_OUTPUT, 736 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 737 } 738 }; 739 740 const std::vector<Operation> operations = { 741 { 742 .type = OperationType::QUANTIZE, 743 .inputs = {0}, 744 .outputs = {1}, 745 } 746 }; 747 748 const std::vector<uint32_t> inputIndexes = {0}; 749 const std::vector<uint32_t> outputIndexes = {1}; 750 std::vector<uint8_t> operandValues = {}; 751 const std::vector<hidl_memory> pools = {}; 752 753 return { 754 .operands = operands, 755 .operations = operations, 756 .inputIndexes = inputIndexes, 757 .outputIndexes = outputIndexes, 758 .operandValues = operandValues, 759 .pools = pools, 760 }; 761 } 762 763 inline bool is_ignored_quant8_8(int i) { 764 static std::set<int> ignore = {}; 765 return ignore.find(i) != ignore.end(); 766 } 767 768 // Create the model 769 Model createTestModel_dynamic_output_shape_quant8_8() { 770 const std::vector<Operand> operands = { 771 { 772 .type = OperandType::TENSOR_FLOAT16, 773 .dimensions = {300}, 774 .numberOfConsumers = 1, 775 .scale = 0.0f, 776 .zeroPoint = 0, 777 .lifetime = OperandLifeTime::MODEL_INPUT, 778 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 779 }, 780 { 781 .type = OperandType::TENSOR_QUANT8_ASYMM, 782 .dimensions = {0}, 783 .numberOfConsumers = 0, 784 .scale = 10.0f, 785 .zeroPoint = 120, 786 .lifetime = OperandLifeTime::MODEL_OUTPUT, 787 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 788 } 789 }; 790 791 const std::vector<Operation> operations = { 792 { 793 .type = OperationType::QUANTIZE, 794 .inputs = {0}, 795 .outputs = {1}, 796 } 797 }; 798 799 const std::vector<uint32_t> inputIndexes = {0}; 800 const std::vector<uint32_t> outputIndexes = {1}; 801 std::vector<uint8_t> operandValues = {}; 802 const std::vector<hidl_memory> pools = {}; 803 804 return { 805 .operands = operands, 806 .operations = operations, 807 .inputIndexes = inputIndexes, 808 .outputIndexes = outputIndexes, 809 .operandValues = operandValues, 810 .pools = pools, 811 }; 812 } 813 814 inline bool is_ignored_dynamic_output_shape_quant8_8(int i) { 815 static std::set<int> ignore = {}; 816 return ignore.find(i) != ignore.end(); 817 } 818 819 // Create the model 820 Model createTestModel_zero_sized() { 821 const std::vector<Operand> operands = { 822 { 823 .type = OperandType::TENSOR_FLOAT32, 824 .dimensions = {1, 2}, 825 .numberOfConsumers = 1, 826 .scale = 0.0f, 827 .zeroPoint = 0, 828 .lifetime = OperandLifeTime::CONSTANT_COPY, 829 .location = {.poolIndex = 0, .offset = 0, .length = 8}, 830 }, 831 { 832 .type = OperandType::TENSOR_FLOAT32, 833 .dimensions = {1, 8}, 834 .numberOfConsumers = 1, 835 .scale = 0.0f, 836 .zeroPoint = 0, 837 .lifetime = OperandLifeTime::CONSTANT_COPY, 838 .location = {.poolIndex = 0, .offset = 8, .length = 32}, 839 }, 840 { 841 .type = OperandType::TENSOR_INT32, 842 .dimensions = {1}, 843 .numberOfConsumers = 1, 844 .scale = 0.0f, 845 .zeroPoint = 0, 846 .lifetime = OperandLifeTime::CONSTANT_COPY, 847 .location = {.poolIndex = 0, .offset = 40, .length = 4}, 848 }, 849 { 850 .type = OperandType::FLOAT32, 851 .dimensions = {}, 852 .numberOfConsumers = 1, 853 .scale = 0.0f, 854 .zeroPoint = 0, 855 .lifetime = OperandLifeTime::CONSTANT_COPY, 856 .location = {.poolIndex = 0, .offset = 44, .length = 4}, 857 }, 858 { 859 .type = OperandType::INT32, 860 .dimensions = {}, 861 .numberOfConsumers = 1, 862 .scale = 0.0f, 863 .zeroPoint = 0, 864 .lifetime = OperandLifeTime::CONSTANT_COPY, 865 .location = {.poolIndex = 0, .offset = 48, .length = 4}, 866 }, 867 { 868 .type = OperandType::INT32, 869 .dimensions = {}, 870 .numberOfConsumers = 1, 871 .scale = 0.0f, 872 .zeroPoint = 0, 873 .lifetime = OperandLifeTime::CONSTANT_COPY, 874 .location = {.poolIndex = 0, .offset = 52, .length = 4}, 875 }, 876 { 877 .type = OperandType::FLOAT32, 878 .dimensions = {}, 879 .numberOfConsumers = 1, 880 .scale = 0.0f, 881 .zeroPoint = 0, 882 .lifetime = OperandLifeTime::CONSTANT_COPY, 883 .location = {.poolIndex = 0, .offset = 56, .length = 4}, 884 }, 885 { 886 .type = OperandType::FLOAT32, 887 .dimensions = {}, 888 .numberOfConsumers = 1, 889 .scale = 0.0f, 890 .zeroPoint = 0, 891 .lifetime = OperandLifeTime::CONSTANT_COPY, 892 .location = {.poolIndex = 0, .offset = 60, .length = 4}, 893 }, 894 { 895 .type = OperandType::FLOAT32, 896 .dimensions = {}, 897 .numberOfConsumers = 1, 898 .scale = 0.0f, 899 .zeroPoint = 0, 900 .lifetime = OperandLifeTime::CONSTANT_COPY, 901 .location = {.poolIndex = 0, .offset = 64, .length = 4}, 902 }, 903 { 904 .type = OperandType::TENSOR_FLOAT32, 905 .dimensions = {0}, 906 .numberOfConsumers = 0, 907 .scale = 0.0f, 908 .zeroPoint = 0, 909 .lifetime = OperandLifeTime::MODEL_OUTPUT, 910 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 911 }, 912 { 913 .type = OperandType::TENSOR_FLOAT32, 914 .dimensions = {0, 4}, 915 .numberOfConsumers = 1, 916 .scale = 0.0f, 917 .zeroPoint = 0, 918 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 919 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 920 }, 921 { 922 .type = OperandType::TENSOR_INT32, 923 .dimensions = {0}, 924 .numberOfConsumers = 0, 925 .scale = 0.0f, 926 .zeroPoint = 0, 927 .lifetime = OperandLifeTime::MODEL_OUTPUT, 928 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 929 }, 930 { 931 .type = OperandType::TENSOR_INT32, 932 .dimensions = {0}, 933 .numberOfConsumers = 1, 934 .scale = 0.0f, 935 .zeroPoint = 0, 936 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 937 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 938 }, 939 { 940 .type = OperandType::TENSOR_FLOAT32, 941 .dimensions = {1, 1, 1, 1}, 942 .numberOfConsumers = 1, 943 .scale = 0.0f, 944 .zeroPoint = 0, 945 .lifetime = OperandLifeTime::MODEL_INPUT, 946 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 947 }, 948 { 949 .type = OperandType::INT32, 950 .dimensions = {}, 951 .numberOfConsumers = 1, 952 .scale = 0.0f, 953 .zeroPoint = 0, 954 .lifetime = OperandLifeTime::CONSTANT_COPY, 955 .location = {.poolIndex = 0, .offset = 68, .length = 4}, 956 }, 957 { 958 .type = OperandType::INT32, 959 .dimensions = {}, 960 .numberOfConsumers = 1, 961 .scale = 0.0f, 962 .zeroPoint = 0, 963 .lifetime = OperandLifeTime::CONSTANT_COPY, 964 .location = {.poolIndex = 0, .offset = 72, .length = 4}, 965 }, 966 { 967 .type = OperandType::FLOAT32, 968 .dimensions = {}, 969 .numberOfConsumers = 1, 970 .scale = 0.0f, 971 .zeroPoint = 0, 972 .lifetime = OperandLifeTime::CONSTANT_COPY, 973 .location = {.poolIndex = 0, .offset = 76, .length = 4}, 974 }, 975 { 976 .type = OperandType::FLOAT32, 977 .dimensions = {}, 978 .numberOfConsumers = 1, 979 .scale = 0.0f, 980 .zeroPoint = 0, 981 .lifetime = OperandLifeTime::CONSTANT_COPY, 982 .location = {.poolIndex = 0, .offset = 80, .length = 4}, 983 }, 984 { 985 .type = OperandType::INT32, 986 .dimensions = {}, 987 .numberOfConsumers = 1, 988 .scale = 0.0f, 989 .zeroPoint = 0, 990 .lifetime = OperandLifeTime::CONSTANT_COPY, 991 .location = {.poolIndex = 0, .offset = 84, .length = 4}, 992 }, 993 { 994 .type = OperandType::INT32, 995 .dimensions = {}, 996 .numberOfConsumers = 1, 997 .scale = 0.0f, 998 .zeroPoint = 0, 999 .lifetime = OperandLifeTime::CONSTANT_COPY, 1000 .location = {.poolIndex = 0, .offset = 88, .length = 4}, 1001 }, 1002 { 1003 .type = OperandType::BOOL, 1004 .dimensions = {}, 1005 .numberOfConsumers = 1, 1006 .scale = 0.0f, 1007 .zeroPoint = 0, 1008 .lifetime = OperandLifeTime::CONSTANT_COPY, 1009 .location = {.poolIndex = 0, .offset = 92, .length = 1}, 1010 }, 1011 { 1012 .type = OperandType::TENSOR_FLOAT32, 1013 .dimensions = {0, 2, 2, 1}, 1014 .numberOfConsumers = 1, 1015 .scale = 0.0f, 1016 .zeroPoint = 0, 1017 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1018 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1019 }, 1020 { 1021 .type = OperandType::TENSOR_QUANT8_ASYMM, 1022 .dimensions = {0, 2, 2, 1}, 1023 .numberOfConsumers = 0, 1024 .scale = 0.1f, 1025 .zeroPoint = 128, 1026 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1027 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1028 } 1029 }; 1030 1031 const std::vector<Operation> operations = { 1032 { 1033 .type = OperationType::BOX_WITH_NMS_LIMIT, 1034 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, 1035 .outputs = {9, 10, 11, 12}, 1036 }, 1037 { 1038 .type = OperationType::ROI_ALIGN, 1039 .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, 1040 .outputs = {21}, 1041 }, 1042 { 1043 .type = OperationType::QUANTIZE, 1044 .inputs = {21}, 1045 .outputs = {22}, 1046 } 1047 }; 1048 1049 const std::vector<uint32_t> inputIndexes = {13}; 1050 const std::vector<uint32_t> outputIndexes = {9, 11, 22}; 1051 std::vector<uint8_t> operandValues = { 1052 102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0 1053 }; 1054 const std::vector<hidl_memory> pools = {}; 1055 1056 return { 1057 .operands = operands, 1058 .operations = operations, 1059 .inputIndexes = inputIndexes, 1060 .outputIndexes = outputIndexes, 1061 .operandValues = operandValues, 1062 .pools = pools, 1063 }; 1064 } 1065 1066 inline bool is_ignored_zero_sized(int i) { 1067 static std::set<int> ignore = {}; 1068 return ignore.find(i) != ignore.end(); 1069 } 1070 1071 // Create the model 1072 Model createTestModel_zero_sized_relaxed() { 1073 const std::vector<Operand> operands = { 1074 { 1075 .type = OperandType::TENSOR_FLOAT32, 1076 .dimensions = {1, 2}, 1077 .numberOfConsumers = 1, 1078 .scale = 0.0f, 1079 .zeroPoint = 0, 1080 .lifetime = OperandLifeTime::CONSTANT_COPY, 1081 .location = {.poolIndex = 0, .offset = 0, .length = 8}, 1082 }, 1083 { 1084 .type = OperandType::TENSOR_FLOAT32, 1085 .dimensions = {1, 8}, 1086 .numberOfConsumers = 1, 1087 .scale = 0.0f, 1088 .zeroPoint = 0, 1089 .lifetime = OperandLifeTime::CONSTANT_COPY, 1090 .location = {.poolIndex = 0, .offset = 8, .length = 32}, 1091 }, 1092 { 1093 .type = OperandType::TENSOR_INT32, 1094 .dimensions = {1}, 1095 .numberOfConsumers = 1, 1096 .scale = 0.0f, 1097 .zeroPoint = 0, 1098 .lifetime = OperandLifeTime::CONSTANT_COPY, 1099 .location = {.poolIndex = 0, .offset = 40, .length = 4}, 1100 }, 1101 { 1102 .type = OperandType::FLOAT32, 1103 .dimensions = {}, 1104 .numberOfConsumers = 1, 1105 .scale = 0.0f, 1106 .zeroPoint = 0, 1107 .lifetime = OperandLifeTime::CONSTANT_COPY, 1108 .location = {.poolIndex = 0, .offset = 44, .length = 4}, 1109 }, 1110 { 1111 .type = OperandType::INT32, 1112 .dimensions = {}, 1113 .numberOfConsumers = 1, 1114 .scale = 0.0f, 1115 .zeroPoint = 0, 1116 .lifetime = OperandLifeTime::CONSTANT_COPY, 1117 .location = {.poolIndex = 0, .offset = 48, .length = 4}, 1118 }, 1119 { 1120 .type = OperandType::INT32, 1121 .dimensions = {}, 1122 .numberOfConsumers = 1, 1123 .scale = 0.0f, 1124 .zeroPoint = 0, 1125 .lifetime = OperandLifeTime::CONSTANT_COPY, 1126 .location = {.poolIndex = 0, .offset = 52, .length = 4}, 1127 }, 1128 { 1129 .type = OperandType::FLOAT32, 1130 .dimensions = {}, 1131 .numberOfConsumers = 1, 1132 .scale = 0.0f, 1133 .zeroPoint = 0, 1134 .lifetime = OperandLifeTime::CONSTANT_COPY, 1135 .location = {.poolIndex = 0, .offset = 56, .length = 4}, 1136 }, 1137 { 1138 .type = OperandType::FLOAT32, 1139 .dimensions = {}, 1140 .numberOfConsumers = 1, 1141 .scale = 0.0f, 1142 .zeroPoint = 0, 1143 .lifetime = OperandLifeTime::CONSTANT_COPY, 1144 .location = {.poolIndex = 0, .offset = 60, .length = 4}, 1145 }, 1146 { 1147 .type = OperandType::FLOAT32, 1148 .dimensions = {}, 1149 .numberOfConsumers = 1, 1150 .scale = 0.0f, 1151 .zeroPoint = 0, 1152 .lifetime = OperandLifeTime::CONSTANT_COPY, 1153 .location = {.poolIndex = 0, .offset = 64, .length = 4}, 1154 }, 1155 { 1156 .type = OperandType::TENSOR_FLOAT32, 1157 .dimensions = {0}, 1158 .numberOfConsumers = 0, 1159 .scale = 0.0f, 1160 .zeroPoint = 0, 1161 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1162 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1163 }, 1164 { 1165 .type = OperandType::TENSOR_FLOAT32, 1166 .dimensions = {0, 4}, 1167 .numberOfConsumers = 1, 1168 .scale = 0.0f, 1169 .zeroPoint = 0, 1170 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1171 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1172 }, 1173 { 1174 .type = OperandType::TENSOR_INT32, 1175 .dimensions = {0}, 1176 .numberOfConsumers = 0, 1177 .scale = 0.0f, 1178 .zeroPoint = 0, 1179 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1180 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1181 }, 1182 { 1183 .type = OperandType::TENSOR_INT32, 1184 .dimensions = {0}, 1185 .numberOfConsumers = 1, 1186 .scale = 0.0f, 1187 .zeroPoint = 0, 1188 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1189 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1190 }, 1191 { 1192 .type = OperandType::TENSOR_FLOAT32, 1193 .dimensions = {1, 1, 1, 1}, 1194 .numberOfConsumers = 1, 1195 .scale = 0.0f, 1196 .zeroPoint = 0, 1197 .lifetime = OperandLifeTime::MODEL_INPUT, 1198 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1199 }, 1200 { 1201 .type = OperandType::INT32, 1202 .dimensions = {}, 1203 .numberOfConsumers = 1, 1204 .scale = 0.0f, 1205 .zeroPoint = 0, 1206 .lifetime = OperandLifeTime::CONSTANT_COPY, 1207 .location = {.poolIndex = 0, .offset = 68, .length = 4}, 1208 }, 1209 { 1210 .type = OperandType::INT32, 1211 .dimensions = {}, 1212 .numberOfConsumers = 1, 1213 .scale = 0.0f, 1214 .zeroPoint = 0, 1215 .lifetime = OperandLifeTime::CONSTANT_COPY, 1216 .location = {.poolIndex = 0, .offset = 72, .length = 4}, 1217 }, 1218 { 1219 .type = OperandType::FLOAT32, 1220 .dimensions = {}, 1221 .numberOfConsumers = 1, 1222 .scale = 0.0f, 1223 .zeroPoint = 0, 1224 .lifetime = OperandLifeTime::CONSTANT_COPY, 1225 .location = {.poolIndex = 0, .offset = 76, .length = 4}, 1226 }, 1227 { 1228 .type = OperandType::FLOAT32, 1229 .dimensions = {}, 1230 .numberOfConsumers = 1, 1231 .scale = 0.0f, 1232 .zeroPoint = 0, 1233 .lifetime = OperandLifeTime::CONSTANT_COPY, 1234 .location = {.poolIndex = 0, .offset = 80, .length = 4}, 1235 }, 1236 { 1237 .type = OperandType::INT32, 1238 .dimensions = {}, 1239 .numberOfConsumers = 1, 1240 .scale = 0.0f, 1241 .zeroPoint = 0, 1242 .lifetime = OperandLifeTime::CONSTANT_COPY, 1243 .location = {.poolIndex = 0, .offset = 84, .length = 4}, 1244 }, 1245 { 1246 .type = OperandType::INT32, 1247 .dimensions = {}, 1248 .numberOfConsumers = 1, 1249 .scale = 0.0f, 1250 .zeroPoint = 0, 1251 .lifetime = OperandLifeTime::CONSTANT_COPY, 1252 .location = {.poolIndex = 0, .offset = 88, .length = 4}, 1253 }, 1254 { 1255 .type = OperandType::BOOL, 1256 .dimensions = {}, 1257 .numberOfConsumers = 1, 1258 .scale = 0.0f, 1259 .zeroPoint = 0, 1260 .lifetime = OperandLifeTime::CONSTANT_COPY, 1261 .location = {.poolIndex = 0, .offset = 92, .length = 1}, 1262 }, 1263 { 1264 .type = OperandType::TENSOR_FLOAT32, 1265 .dimensions = {0, 2, 2, 1}, 1266 .numberOfConsumers = 1, 1267 .scale = 0.0f, 1268 .zeroPoint = 0, 1269 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1270 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1271 }, 1272 { 1273 .type = OperandType::TENSOR_QUANT8_ASYMM, 1274 .dimensions = {0, 2, 2, 1}, 1275 .numberOfConsumers = 0, 1276 .scale = 0.1f, 1277 .zeroPoint = 128, 1278 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1279 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1280 } 1281 }; 1282 1283 const std::vector<Operation> operations = { 1284 { 1285 .type = OperationType::BOX_WITH_NMS_LIMIT, 1286 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, 1287 .outputs = {9, 10, 11, 12}, 1288 }, 1289 { 1290 .type = OperationType::ROI_ALIGN, 1291 .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, 1292 .outputs = {21}, 1293 }, 1294 { 1295 .type = OperationType::QUANTIZE, 1296 .inputs = {21}, 1297 .outputs = {22}, 1298 } 1299 }; 1300 1301 const std::vector<uint32_t> inputIndexes = {13}; 1302 const std::vector<uint32_t> outputIndexes = {9, 11, 22}; 1303 std::vector<uint8_t> operandValues = { 1304 102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0 1305 }; 1306 const std::vector<hidl_memory> pools = {}; 1307 1308 return { 1309 .operands = operands, 1310 .operations = operations, 1311 .inputIndexes = inputIndexes, 1312 .outputIndexes = outputIndexes, 1313 .operandValues = operandValues, 1314 .pools = pools, 1315 .relaxComputationFloat32toFloat16 = true, 1316 }; 1317 } 1318 1319 inline bool is_ignored_zero_sized_relaxed(int i) { 1320 static std::set<int> ignore = {}; 1321 return ignore.find(i) != ignore.end(); 1322 } 1323 1324 // Create the model 1325 Model createTestModel_zero_sized_float16() { 1326 const std::vector<Operand> operands = { 1327 { 1328 .type = OperandType::TENSOR_FLOAT16, 1329 .dimensions = {1, 2}, 1330 .numberOfConsumers = 1, 1331 .scale = 0.0f, 1332 .zeroPoint = 0, 1333 .lifetime = OperandLifeTime::CONSTANT_COPY, 1334 .location = {.poolIndex = 0, .offset = 0, .length = 4}, 1335 }, 1336 { 1337 .type = OperandType::TENSOR_FLOAT16, 1338 .dimensions = {1, 8}, 1339 .numberOfConsumers = 1, 1340 .scale = 0.0f, 1341 .zeroPoint = 0, 1342 .lifetime = OperandLifeTime::CONSTANT_COPY, 1343 .location = {.poolIndex = 0, .offset = 4, .length = 16}, 1344 }, 1345 { 1346 .type = OperandType::TENSOR_INT32, 1347 .dimensions = {1}, 1348 .numberOfConsumers = 1, 1349 .scale = 0.0f, 1350 .zeroPoint = 0, 1351 .lifetime = OperandLifeTime::CONSTANT_COPY, 1352 .location = {.poolIndex = 0, .offset = 20, .length = 4}, 1353 }, 1354 { 1355 .type = OperandType::FLOAT16, 1356 .dimensions = {}, 1357 .numberOfConsumers = 1, 1358 .scale = 0.0f, 1359 .zeroPoint = 0, 1360 .lifetime = OperandLifeTime::CONSTANT_COPY, 1361 .location = {.poolIndex = 0, .offset = 24, .length = 2}, 1362 }, 1363 { 1364 .type = OperandType::INT32, 1365 .dimensions = {}, 1366 .numberOfConsumers = 1, 1367 .scale = 0.0f, 1368 .zeroPoint = 0, 1369 .lifetime = OperandLifeTime::CONSTANT_COPY, 1370 .location = {.poolIndex = 0, .offset = 26, .length = 4}, 1371 }, 1372 { 1373 .type = OperandType::INT32, 1374 .dimensions = {}, 1375 .numberOfConsumers = 1, 1376 .scale = 0.0f, 1377 .zeroPoint = 0, 1378 .lifetime = OperandLifeTime::CONSTANT_COPY, 1379 .location = {.poolIndex = 0, .offset = 30, .length = 4}, 1380 }, 1381 { 1382 .type = OperandType::FLOAT16, 1383 .dimensions = {}, 1384 .numberOfConsumers = 1, 1385 .scale = 0.0f, 1386 .zeroPoint = 0, 1387 .lifetime = OperandLifeTime::CONSTANT_COPY, 1388 .location = {.poolIndex = 0, .offset = 34, .length = 2}, 1389 }, 1390 { 1391 .type = OperandType::FLOAT16, 1392 .dimensions = {}, 1393 .numberOfConsumers = 1, 1394 .scale = 0.0f, 1395 .zeroPoint = 0, 1396 .lifetime = OperandLifeTime::CONSTANT_COPY, 1397 .location = {.poolIndex = 0, .offset = 36, .length = 2}, 1398 }, 1399 { 1400 .type = OperandType::FLOAT16, 1401 .dimensions = {}, 1402 .numberOfConsumers = 1, 1403 .scale = 0.0f, 1404 .zeroPoint = 0, 1405 .lifetime = OperandLifeTime::CONSTANT_COPY, 1406 .location = {.poolIndex = 0, .offset = 38, .length = 2}, 1407 }, 1408 { 1409 .type = OperandType::TENSOR_FLOAT16, 1410 .dimensions = {0}, 1411 .numberOfConsumers = 0, 1412 .scale = 0.0f, 1413 .zeroPoint = 0, 1414 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1415 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1416 }, 1417 { 1418 .type = OperandType::TENSOR_FLOAT16, 1419 .dimensions = {0, 4}, 1420 .numberOfConsumers = 1, 1421 .scale = 0.0f, 1422 .zeroPoint = 0, 1423 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1424 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1425 }, 1426 { 1427 .type = OperandType::TENSOR_INT32, 1428 .dimensions = {0}, 1429 .numberOfConsumers = 0, 1430 .scale = 0.0f, 1431 .zeroPoint = 0, 1432 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1433 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1434 }, 1435 { 1436 .type = OperandType::TENSOR_INT32, 1437 .dimensions = {0}, 1438 .numberOfConsumers = 1, 1439 .scale = 0.0f, 1440 .zeroPoint = 0, 1441 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1442 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1443 }, 1444 { 1445 .type = OperandType::TENSOR_FLOAT16, 1446 .dimensions = {1, 1, 1, 1}, 1447 .numberOfConsumers = 1, 1448 .scale = 0.0f, 1449 .zeroPoint = 0, 1450 .lifetime = OperandLifeTime::MODEL_INPUT, 1451 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1452 }, 1453 { 1454 .type = OperandType::INT32, 1455 .dimensions = {}, 1456 .numberOfConsumers = 1, 1457 .scale = 0.0f, 1458 .zeroPoint = 0, 1459 .lifetime = OperandLifeTime::CONSTANT_COPY, 1460 .location = {.poolIndex = 0, .offset = 40, .length = 4}, 1461 }, 1462 { 1463 .type = OperandType::INT32, 1464 .dimensions = {}, 1465 .numberOfConsumers = 1, 1466 .scale = 0.0f, 1467 .zeroPoint = 0, 1468 .lifetime = OperandLifeTime::CONSTANT_COPY, 1469 .location = {.poolIndex = 0, .offset = 44, .length = 4}, 1470 }, 1471 { 1472 .type = OperandType::FLOAT16, 1473 .dimensions = {}, 1474 .numberOfConsumers = 1, 1475 .scale = 0.0f, 1476 .zeroPoint = 0, 1477 .lifetime = OperandLifeTime::CONSTANT_COPY, 1478 .location = {.poolIndex = 0, .offset = 48, .length = 2}, 1479 }, 1480 { 1481 .type = OperandType::FLOAT16, 1482 .dimensions = {}, 1483 .numberOfConsumers = 1, 1484 .scale = 0.0f, 1485 .zeroPoint = 0, 1486 .lifetime = OperandLifeTime::CONSTANT_COPY, 1487 .location = {.poolIndex = 0, .offset = 50, .length = 2}, 1488 }, 1489 { 1490 .type = OperandType::INT32, 1491 .dimensions = {}, 1492 .numberOfConsumers = 1, 1493 .scale = 0.0f, 1494 .zeroPoint = 0, 1495 .lifetime = OperandLifeTime::CONSTANT_COPY, 1496 .location = {.poolIndex = 0, .offset = 52, .length = 4}, 1497 }, 1498 { 1499 .type = OperandType::INT32, 1500 .dimensions = {}, 1501 .numberOfConsumers = 1, 1502 .scale = 0.0f, 1503 .zeroPoint = 0, 1504 .lifetime = OperandLifeTime::CONSTANT_COPY, 1505 .location = {.poolIndex = 0, .offset = 56, .length = 4}, 1506 }, 1507 { 1508 .type = OperandType::BOOL, 1509 .dimensions = {}, 1510 .numberOfConsumers = 1, 1511 .scale = 0.0f, 1512 .zeroPoint = 0, 1513 .lifetime = OperandLifeTime::CONSTANT_COPY, 1514 .location = {.poolIndex = 0, .offset = 60, .length = 1}, 1515 }, 1516 { 1517 .type = OperandType::TENSOR_FLOAT16, 1518 .dimensions = {0, 2, 2, 1}, 1519 .numberOfConsumers = 1, 1520 .scale = 0.0f, 1521 .zeroPoint = 0, 1522 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1523 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1524 }, 1525 { 1526 .type = OperandType::TENSOR_QUANT8_ASYMM, 1527 .dimensions = {0, 2, 2, 1}, 1528 .numberOfConsumers = 0, 1529 .scale = 0.1f, 1530 .zeroPoint = 128, 1531 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1532 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1533 } 1534 }; 1535 1536 const std::vector<Operation> operations = { 1537 { 1538 .type = OperationType::BOX_WITH_NMS_LIMIT, 1539 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, 1540 .outputs = {9, 10, 11, 12}, 1541 }, 1542 { 1543 .type = OperationType::ROI_ALIGN, 1544 .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, 1545 .outputs = {21}, 1546 }, 1547 { 1548 .type = OperationType::QUANTIZE, 1549 .inputs = {21}, 1550 .outputs = {22}, 1551 } 1552 }; 1553 1554 const std::vector<uint32_t> inputIndexes = {13}; 1555 const std::vector<uint32_t> outputIndexes = {9, 11, 22}; 1556 std::vector<uint8_t> operandValues = { 1557 51, 59, 102, 46, 0, 60, 0, 60, 0, 73, 0, 73, 0, 0, 0, 0, 0, 73, 0, 73, 0, 0, 0, 0, 205, 52, 255, 255, 255, 255, 0, 0, 0, 0, 102, 54, 0, 60, 205, 52, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0 1558 }; 1559 const std::vector<hidl_memory> pools = {}; 1560 1561 return { 1562 .operands = operands, 1563 .operations = operations, 1564 .inputIndexes = inputIndexes, 1565 .outputIndexes = outputIndexes, 1566 .operandValues = operandValues, 1567 .pools = pools, 1568 }; 1569 } 1570 1571 inline bool is_ignored_zero_sized_float16(int i) { 1572 static std::set<int> ignore = {}; 1573 return ignore.find(i) != ignore.end(); 1574 } 1575 1576 // Create the model 1577 Model createTestModel_zero_sized_dynamic_output_shape() { 1578 const std::vector<Operand> operands = { 1579 { 1580 .type = OperandType::TENSOR_FLOAT32, 1581 .dimensions = {1, 2}, 1582 .numberOfConsumers = 1, 1583 .scale = 0.0f, 1584 .zeroPoint = 0, 1585 .lifetime = OperandLifeTime::CONSTANT_COPY, 1586 .location = {.poolIndex = 0, .offset = 0, .length = 8}, 1587 }, 1588 { 1589 .type = OperandType::TENSOR_FLOAT32, 1590 .dimensions = {1, 8}, 1591 .numberOfConsumers = 1, 1592 .scale = 0.0f, 1593 .zeroPoint = 0, 1594 .lifetime = OperandLifeTime::CONSTANT_COPY, 1595 .location = {.poolIndex = 0, .offset = 8, .length = 32}, 1596 }, 1597 { 1598 .type = OperandType::TENSOR_INT32, 1599 .dimensions = {1}, 1600 .numberOfConsumers = 1, 1601 .scale = 0.0f, 1602 .zeroPoint = 0, 1603 .lifetime = OperandLifeTime::CONSTANT_COPY, 1604 .location = {.poolIndex = 0, .offset = 40, .length = 4}, 1605 }, 1606 { 1607 .type = OperandType::FLOAT32, 1608 .dimensions = {}, 1609 .numberOfConsumers = 1, 1610 .scale = 0.0f, 1611 .zeroPoint = 0, 1612 .lifetime = OperandLifeTime::CONSTANT_COPY, 1613 .location = {.poolIndex = 0, .offset = 44, .length = 4}, 1614 }, 1615 { 1616 .type = OperandType::INT32, 1617 .dimensions = {}, 1618 .numberOfConsumers = 1, 1619 .scale = 0.0f, 1620 .zeroPoint = 0, 1621 .lifetime = OperandLifeTime::CONSTANT_COPY, 1622 .location = {.poolIndex = 0, .offset = 48, .length = 4}, 1623 }, 1624 { 1625 .type = OperandType::INT32, 1626 .dimensions = {}, 1627 .numberOfConsumers = 1, 1628 .scale = 0.0f, 1629 .zeroPoint = 0, 1630 .lifetime = OperandLifeTime::CONSTANT_COPY, 1631 .location = {.poolIndex = 0, .offset = 52, .length = 4}, 1632 }, 1633 { 1634 .type = OperandType::FLOAT32, 1635 .dimensions = {}, 1636 .numberOfConsumers = 1, 1637 .scale = 0.0f, 1638 .zeroPoint = 0, 1639 .lifetime = OperandLifeTime::CONSTANT_COPY, 1640 .location = {.poolIndex = 0, .offset = 56, .length = 4}, 1641 }, 1642 { 1643 .type = OperandType::FLOAT32, 1644 .dimensions = {}, 1645 .numberOfConsumers = 1, 1646 .scale = 0.0f, 1647 .zeroPoint = 0, 1648 .lifetime = OperandLifeTime::CONSTANT_COPY, 1649 .location = {.poolIndex = 0, .offset = 60, .length = 4}, 1650 }, 1651 { 1652 .type = OperandType::FLOAT32, 1653 .dimensions = {}, 1654 .numberOfConsumers = 1, 1655 .scale = 0.0f, 1656 .zeroPoint = 0, 1657 .lifetime = OperandLifeTime::CONSTANT_COPY, 1658 .location = {.poolIndex = 0, .offset = 64, .length = 4}, 1659 }, 1660 { 1661 .type = OperandType::TENSOR_FLOAT32, 1662 .dimensions = {0}, 1663 .numberOfConsumers = 0, 1664 .scale = 0.0f, 1665 .zeroPoint = 0, 1666 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1667 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1668 }, 1669 { 1670 .type = OperandType::TENSOR_FLOAT32, 1671 .dimensions = {0, 4}, 1672 .numberOfConsumers = 1, 1673 .scale = 0.0f, 1674 .zeroPoint = 0, 1675 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1676 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1677 }, 1678 { 1679 .type = OperandType::TENSOR_INT32, 1680 .dimensions = {0}, 1681 .numberOfConsumers = 0, 1682 .scale = 0.0f, 1683 .zeroPoint = 0, 1684 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1685 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1686 }, 1687 { 1688 .type = OperandType::TENSOR_INT32, 1689 .dimensions = {0}, 1690 .numberOfConsumers = 1, 1691 .scale = 0.0f, 1692 .zeroPoint = 0, 1693 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1694 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1695 }, 1696 { 1697 .type = OperandType::TENSOR_FLOAT32, 1698 .dimensions = {1, 1, 1, 1}, 1699 .numberOfConsumers = 1, 1700 .scale = 0.0f, 1701 .zeroPoint = 0, 1702 .lifetime = OperandLifeTime::MODEL_INPUT, 1703 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1704 }, 1705 { 1706 .type = OperandType::INT32, 1707 .dimensions = {}, 1708 .numberOfConsumers = 1, 1709 .scale = 0.0f, 1710 .zeroPoint = 0, 1711 .lifetime = OperandLifeTime::CONSTANT_COPY, 1712 .location = {.poolIndex = 0, .offset = 68, .length = 4}, 1713 }, 1714 { 1715 .type = OperandType::INT32, 1716 .dimensions = {}, 1717 .numberOfConsumers = 1, 1718 .scale = 0.0f, 1719 .zeroPoint = 0, 1720 .lifetime = OperandLifeTime::CONSTANT_COPY, 1721 .location = {.poolIndex = 0, .offset = 72, .length = 4}, 1722 }, 1723 { 1724 .type = OperandType::FLOAT32, 1725 .dimensions = {}, 1726 .numberOfConsumers = 1, 1727 .scale = 0.0f, 1728 .zeroPoint = 0, 1729 .lifetime = OperandLifeTime::CONSTANT_COPY, 1730 .location = {.poolIndex = 0, .offset = 76, .length = 4}, 1731 }, 1732 { 1733 .type = OperandType::FLOAT32, 1734 .dimensions = {}, 1735 .numberOfConsumers = 1, 1736 .scale = 0.0f, 1737 .zeroPoint = 0, 1738 .lifetime = OperandLifeTime::CONSTANT_COPY, 1739 .location = {.poolIndex = 0, .offset = 80, .length = 4}, 1740 }, 1741 { 1742 .type = OperandType::INT32, 1743 .dimensions = {}, 1744 .numberOfConsumers = 1, 1745 .scale = 0.0f, 1746 .zeroPoint = 0, 1747 .lifetime = OperandLifeTime::CONSTANT_COPY, 1748 .location = {.poolIndex = 0, .offset = 84, .length = 4}, 1749 }, 1750 { 1751 .type = OperandType::INT32, 1752 .dimensions = {}, 1753 .numberOfConsumers = 1, 1754 .scale = 0.0f, 1755 .zeroPoint = 0, 1756 .lifetime = OperandLifeTime::CONSTANT_COPY, 1757 .location = {.poolIndex = 0, .offset = 88, .length = 4}, 1758 }, 1759 { 1760 .type = OperandType::BOOL, 1761 .dimensions = {}, 1762 .numberOfConsumers = 1, 1763 .scale = 0.0f, 1764 .zeroPoint = 0, 1765 .lifetime = OperandLifeTime::CONSTANT_COPY, 1766 .location = {.poolIndex = 0, .offset = 92, .length = 1}, 1767 }, 1768 { 1769 .type = OperandType::TENSOR_FLOAT32, 1770 .dimensions = {0, 2, 2, 1}, 1771 .numberOfConsumers = 1, 1772 .scale = 0.0f, 1773 .zeroPoint = 0, 1774 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1775 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1776 }, 1777 { 1778 .type = OperandType::TENSOR_QUANT8_ASYMM, 1779 .dimensions = {0, 0, 0, 0}, 1780 .numberOfConsumers = 0, 1781 .scale = 0.1f, 1782 .zeroPoint = 128, 1783 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1784 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1785 } 1786 }; 1787 1788 const std::vector<Operation> operations = { 1789 { 1790 .type = OperationType::BOX_WITH_NMS_LIMIT, 1791 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, 1792 .outputs = {9, 10, 11, 12}, 1793 }, 1794 { 1795 .type = OperationType::ROI_ALIGN, 1796 .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, 1797 .outputs = {21}, 1798 }, 1799 { 1800 .type = OperationType::QUANTIZE, 1801 .inputs = {21}, 1802 .outputs = {22}, 1803 } 1804 }; 1805 1806 const std::vector<uint32_t> inputIndexes = {13}; 1807 const std::vector<uint32_t> outputIndexes = {9, 11, 22}; 1808 std::vector<uint8_t> operandValues = { 1809 102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0 1810 }; 1811 const std::vector<hidl_memory> pools = {}; 1812 1813 return { 1814 .operands = operands, 1815 .operations = operations, 1816 .inputIndexes = inputIndexes, 1817 .outputIndexes = outputIndexes, 1818 .operandValues = operandValues, 1819 .pools = pools, 1820 }; 1821 } 1822 1823 inline bool is_ignored_zero_sized_dynamic_output_shape(int i) { 1824 static std::set<int> ignore = {}; 1825 return ignore.find(i) != ignore.end(); 1826 } 1827 1828 // Create the model 1829 Model createTestModel_zero_sized_dynamic_output_shape_relaxed() { 1830 const std::vector<Operand> operands = { 1831 { 1832 .type = OperandType::TENSOR_FLOAT32, 1833 .dimensions = {1, 2}, 1834 .numberOfConsumers = 1, 1835 .scale = 0.0f, 1836 .zeroPoint = 0, 1837 .lifetime = OperandLifeTime::CONSTANT_COPY, 1838 .location = {.poolIndex = 0, .offset = 0, .length = 8}, 1839 }, 1840 { 1841 .type = OperandType::TENSOR_FLOAT32, 1842 .dimensions = {1, 8}, 1843 .numberOfConsumers = 1, 1844 .scale = 0.0f, 1845 .zeroPoint = 0, 1846 .lifetime = OperandLifeTime::CONSTANT_COPY, 1847 .location = {.poolIndex = 0, .offset = 8, .length = 32}, 1848 }, 1849 { 1850 .type = OperandType::TENSOR_INT32, 1851 .dimensions = {1}, 1852 .numberOfConsumers = 1, 1853 .scale = 0.0f, 1854 .zeroPoint = 0, 1855 .lifetime = OperandLifeTime::CONSTANT_COPY, 1856 .location = {.poolIndex = 0, .offset = 40, .length = 4}, 1857 }, 1858 { 1859 .type = OperandType::FLOAT32, 1860 .dimensions = {}, 1861 .numberOfConsumers = 1, 1862 .scale = 0.0f, 1863 .zeroPoint = 0, 1864 .lifetime = OperandLifeTime::CONSTANT_COPY, 1865 .location = {.poolIndex = 0, .offset = 44, .length = 4}, 1866 }, 1867 { 1868 .type = OperandType::INT32, 1869 .dimensions = {}, 1870 .numberOfConsumers = 1, 1871 .scale = 0.0f, 1872 .zeroPoint = 0, 1873 .lifetime = OperandLifeTime::CONSTANT_COPY, 1874 .location = {.poolIndex = 0, .offset = 48, .length = 4}, 1875 }, 1876 { 1877 .type = OperandType::INT32, 1878 .dimensions = {}, 1879 .numberOfConsumers = 1, 1880 .scale = 0.0f, 1881 .zeroPoint = 0, 1882 .lifetime = OperandLifeTime::CONSTANT_COPY, 1883 .location = {.poolIndex = 0, .offset = 52, .length = 4}, 1884 }, 1885 { 1886 .type = OperandType::FLOAT32, 1887 .dimensions = {}, 1888 .numberOfConsumers = 1, 1889 .scale = 0.0f, 1890 .zeroPoint = 0, 1891 .lifetime = OperandLifeTime::CONSTANT_COPY, 1892 .location = {.poolIndex = 0, .offset = 56, .length = 4}, 1893 }, 1894 { 1895 .type = OperandType::FLOAT32, 1896 .dimensions = {}, 1897 .numberOfConsumers = 1, 1898 .scale = 0.0f, 1899 .zeroPoint = 0, 1900 .lifetime = OperandLifeTime::CONSTANT_COPY, 1901 .location = {.poolIndex = 0, .offset = 60, .length = 4}, 1902 }, 1903 { 1904 .type = OperandType::FLOAT32, 1905 .dimensions = {}, 1906 .numberOfConsumers = 1, 1907 .scale = 0.0f, 1908 .zeroPoint = 0, 1909 .lifetime = OperandLifeTime::CONSTANT_COPY, 1910 .location = {.poolIndex = 0, .offset = 64, .length = 4}, 1911 }, 1912 { 1913 .type = OperandType::TENSOR_FLOAT32, 1914 .dimensions = {0}, 1915 .numberOfConsumers = 0, 1916 .scale = 0.0f, 1917 .zeroPoint = 0, 1918 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1919 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1920 }, 1921 { 1922 .type = OperandType::TENSOR_FLOAT32, 1923 .dimensions = {0, 4}, 1924 .numberOfConsumers = 1, 1925 .scale = 0.0f, 1926 .zeroPoint = 0, 1927 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1928 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1929 }, 1930 { 1931 .type = OperandType::TENSOR_INT32, 1932 .dimensions = {0}, 1933 .numberOfConsumers = 0, 1934 .scale = 0.0f, 1935 .zeroPoint = 0, 1936 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1937 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1938 }, 1939 { 1940 .type = OperandType::TENSOR_INT32, 1941 .dimensions = {0}, 1942 .numberOfConsumers = 1, 1943 .scale = 0.0f, 1944 .zeroPoint = 0, 1945 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 1946 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1947 }, 1948 { 1949 .type = OperandType::TENSOR_FLOAT32, 1950 .dimensions = {1, 1, 1, 1}, 1951 .numberOfConsumers = 1, 1952 .scale = 0.0f, 1953 .zeroPoint = 0, 1954 .lifetime = OperandLifeTime::MODEL_INPUT, 1955 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1956 }, 1957 { 1958 .type = OperandType::INT32, 1959 .dimensions = {}, 1960 .numberOfConsumers = 1, 1961 .scale = 0.0f, 1962 .zeroPoint = 0, 1963 .lifetime = OperandLifeTime::CONSTANT_COPY, 1964 .location = {.poolIndex = 0, .offset = 68, .length = 4}, 1965 }, 1966 { 1967 .type = OperandType::INT32, 1968 .dimensions = {}, 1969 .numberOfConsumers = 1, 1970 .scale = 0.0f, 1971 .zeroPoint = 0, 1972 .lifetime = OperandLifeTime::CONSTANT_COPY, 1973 .location = {.poolIndex = 0, .offset = 72, .length = 4}, 1974 }, 1975 { 1976 .type = OperandType::FLOAT32, 1977 .dimensions = {}, 1978 .numberOfConsumers = 1, 1979 .scale = 0.0f, 1980 .zeroPoint = 0, 1981 .lifetime = OperandLifeTime::CONSTANT_COPY, 1982 .location = {.poolIndex = 0, .offset = 76, .length = 4}, 1983 }, 1984 { 1985 .type = OperandType::FLOAT32, 1986 .dimensions = {}, 1987 .numberOfConsumers = 1, 1988 .scale = 0.0f, 1989 .zeroPoint = 0, 1990 .lifetime = OperandLifeTime::CONSTANT_COPY, 1991 .location = {.poolIndex = 0, .offset = 80, .length = 4}, 1992 }, 1993 { 1994 .type = OperandType::INT32, 1995 .dimensions = {}, 1996 .numberOfConsumers = 1, 1997 .scale = 0.0f, 1998 .zeroPoint = 0, 1999 .lifetime = OperandLifeTime::CONSTANT_COPY, 2000 .location = {.poolIndex = 0, .offset = 84, .length = 4}, 2001 }, 2002 { 2003 .type = OperandType::INT32, 2004 .dimensions = {}, 2005 .numberOfConsumers = 1, 2006 .scale = 0.0f, 2007 .zeroPoint = 0, 2008 .lifetime = OperandLifeTime::CONSTANT_COPY, 2009 .location = {.poolIndex = 0, .offset = 88, .length = 4}, 2010 }, 2011 { 2012 .type = OperandType::BOOL, 2013 .dimensions = {}, 2014 .numberOfConsumers = 1, 2015 .scale = 0.0f, 2016 .zeroPoint = 0, 2017 .lifetime = OperandLifeTime::CONSTANT_COPY, 2018 .location = {.poolIndex = 0, .offset = 92, .length = 1}, 2019 }, 2020 { 2021 .type = OperandType::TENSOR_FLOAT32, 2022 .dimensions = {0, 2, 2, 1}, 2023 .numberOfConsumers = 1, 2024 .scale = 0.0f, 2025 .zeroPoint = 0, 2026 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 2027 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2028 }, 2029 { 2030 .type = OperandType::TENSOR_QUANT8_ASYMM, 2031 .dimensions = {0, 0, 0, 0}, 2032 .numberOfConsumers = 0, 2033 .scale = 0.1f, 2034 .zeroPoint = 128, 2035 .lifetime = OperandLifeTime::MODEL_OUTPUT, 2036 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2037 } 2038 }; 2039 2040 const std::vector<Operation> operations = { 2041 { 2042 .type = OperationType::BOX_WITH_NMS_LIMIT, 2043 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, 2044 .outputs = {9, 10, 11, 12}, 2045 }, 2046 { 2047 .type = OperationType::ROI_ALIGN, 2048 .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, 2049 .outputs = {21}, 2050 }, 2051 { 2052 .type = OperationType::QUANTIZE, 2053 .inputs = {21}, 2054 .outputs = {22}, 2055 } 2056 }; 2057 2058 const std::vector<uint32_t> inputIndexes = {13}; 2059 const std::vector<uint32_t> outputIndexes = {9, 11, 22}; 2060 std::vector<uint8_t> operandValues = { 2061 102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0 2062 }; 2063 const std::vector<hidl_memory> pools = {}; 2064 2065 return { 2066 .operands = operands, 2067 .operations = operations, 2068 .inputIndexes = inputIndexes, 2069 .outputIndexes = outputIndexes, 2070 .operandValues = operandValues, 2071 .pools = pools, 2072 .relaxComputationFloat32toFloat16 = true, 2073 }; 2074 } 2075 2076 inline bool is_ignored_zero_sized_dynamic_output_shape_relaxed(int i) { 2077 static std::set<int> ignore = {}; 2078 return ignore.find(i) != ignore.end(); 2079 } 2080 2081 // Create the model 2082 Model createTestModel_zero_sized_dynamic_output_shape_float16() { 2083 const std::vector<Operand> operands = { 2084 { 2085 .type = OperandType::TENSOR_FLOAT16, 2086 .dimensions = {1, 2}, 2087 .numberOfConsumers = 1, 2088 .scale = 0.0f, 2089 .zeroPoint = 0, 2090 .lifetime = OperandLifeTime::CONSTANT_COPY, 2091 .location = {.poolIndex = 0, .offset = 0, .length = 4}, 2092 }, 2093 { 2094 .type = OperandType::TENSOR_FLOAT16, 2095 .dimensions = {1, 8}, 2096 .numberOfConsumers = 1, 2097 .scale = 0.0f, 2098 .zeroPoint = 0, 2099 .lifetime = OperandLifeTime::CONSTANT_COPY, 2100 .location = {.poolIndex = 0, .offset = 4, .length = 16}, 2101 }, 2102 { 2103 .type = OperandType::TENSOR_INT32, 2104 .dimensions = {1}, 2105 .numberOfConsumers = 1, 2106 .scale = 0.0f, 2107 .zeroPoint = 0, 2108 .lifetime = OperandLifeTime::CONSTANT_COPY, 2109 .location = {.poolIndex = 0, .offset = 20, .length = 4}, 2110 }, 2111 { 2112 .type = OperandType::FLOAT16, 2113 .dimensions = {}, 2114 .numberOfConsumers = 1, 2115 .scale = 0.0f, 2116 .zeroPoint = 0, 2117 .lifetime = OperandLifeTime::CONSTANT_COPY, 2118 .location = {.poolIndex = 0, .offset = 24, .length = 2}, 2119 }, 2120 { 2121 .type = OperandType::INT32, 2122 .dimensions = {}, 2123 .numberOfConsumers = 1, 2124 .scale = 0.0f, 2125 .zeroPoint = 0, 2126 .lifetime = OperandLifeTime::CONSTANT_COPY, 2127 .location = {.poolIndex = 0, .offset = 26, .length = 4}, 2128 }, 2129 { 2130 .type = OperandType::INT32, 2131 .dimensions = {}, 2132 .numberOfConsumers = 1, 2133 .scale = 0.0f, 2134 .zeroPoint = 0, 2135 .lifetime = OperandLifeTime::CONSTANT_COPY, 2136 .location = {.poolIndex = 0, .offset = 30, .length = 4}, 2137 }, 2138 { 2139 .type = OperandType::FLOAT16, 2140 .dimensions = {}, 2141 .numberOfConsumers = 1, 2142 .scale = 0.0f, 2143 .zeroPoint = 0, 2144 .lifetime = OperandLifeTime::CONSTANT_COPY, 2145 .location = {.poolIndex = 0, .offset = 34, .length = 2}, 2146 }, 2147 { 2148 .type = OperandType::FLOAT16, 2149 .dimensions = {}, 2150 .numberOfConsumers = 1, 2151 .scale = 0.0f, 2152 .zeroPoint = 0, 2153 .lifetime = OperandLifeTime::CONSTANT_COPY, 2154 .location = {.poolIndex = 0, .offset = 36, .length = 2}, 2155 }, 2156 { 2157 .type = OperandType::FLOAT16, 2158 .dimensions = {}, 2159 .numberOfConsumers = 1, 2160 .scale = 0.0f, 2161 .zeroPoint = 0, 2162 .lifetime = OperandLifeTime::CONSTANT_COPY, 2163 .location = {.poolIndex = 0, .offset = 38, .length = 2}, 2164 }, 2165 { 2166 .type = OperandType::TENSOR_FLOAT16, 2167 .dimensions = {0}, 2168 .numberOfConsumers = 0, 2169 .scale = 0.0f, 2170 .zeroPoint = 0, 2171 .lifetime = OperandLifeTime::MODEL_OUTPUT, 2172 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2173 }, 2174 { 2175 .type = OperandType::TENSOR_FLOAT16, 2176 .dimensions = {0, 4}, 2177 .numberOfConsumers = 1, 2178 .scale = 0.0f, 2179 .zeroPoint = 0, 2180 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 2181 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2182 }, 2183 { 2184 .type = OperandType::TENSOR_INT32, 2185 .dimensions = {0}, 2186 .numberOfConsumers = 0, 2187 .scale = 0.0f, 2188 .zeroPoint = 0, 2189 .lifetime = OperandLifeTime::MODEL_OUTPUT, 2190 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2191 }, 2192 { 2193 .type = OperandType::TENSOR_INT32, 2194 .dimensions = {0}, 2195 .numberOfConsumers = 1, 2196 .scale = 0.0f, 2197 .zeroPoint = 0, 2198 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 2199 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2200 }, 2201 { 2202 .type = OperandType::TENSOR_FLOAT16, 2203 .dimensions = {1, 1, 1, 1}, 2204 .numberOfConsumers = 1, 2205 .scale = 0.0f, 2206 .zeroPoint = 0, 2207 .lifetime = OperandLifeTime::MODEL_INPUT, 2208 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2209 }, 2210 { 2211 .type = OperandType::INT32, 2212 .dimensions = {}, 2213 .numberOfConsumers = 1, 2214 .scale = 0.0f, 2215 .zeroPoint = 0, 2216 .lifetime = OperandLifeTime::CONSTANT_COPY, 2217 .location = {.poolIndex = 0, .offset = 40, .length = 4}, 2218 }, 2219 { 2220 .type = OperandType::INT32, 2221 .dimensions = {}, 2222 .numberOfConsumers = 1, 2223 .scale = 0.0f, 2224 .zeroPoint = 0, 2225 .lifetime = OperandLifeTime::CONSTANT_COPY, 2226 .location = {.poolIndex = 0, .offset = 44, .length = 4}, 2227 }, 2228 { 2229 .type = OperandType::FLOAT16, 2230 .dimensions = {}, 2231 .numberOfConsumers = 1, 2232 .scale = 0.0f, 2233 .zeroPoint = 0, 2234 .lifetime = OperandLifeTime::CONSTANT_COPY, 2235 .location = {.poolIndex = 0, .offset = 48, .length = 2}, 2236 }, 2237 { 2238 .type = OperandType::FLOAT16, 2239 .dimensions = {}, 2240 .numberOfConsumers = 1, 2241 .scale = 0.0f, 2242 .zeroPoint = 0, 2243 .lifetime = OperandLifeTime::CONSTANT_COPY, 2244 .location = {.poolIndex = 0, .offset = 50, .length = 2}, 2245 }, 2246 { 2247 .type = OperandType::INT32, 2248 .dimensions = {}, 2249 .numberOfConsumers = 1, 2250 .scale = 0.0f, 2251 .zeroPoint = 0, 2252 .lifetime = OperandLifeTime::CONSTANT_COPY, 2253 .location = {.poolIndex = 0, .offset = 52, .length = 4}, 2254 }, 2255 { 2256 .type = OperandType::INT32, 2257 .dimensions = {}, 2258 .numberOfConsumers = 1, 2259 .scale = 0.0f, 2260 .zeroPoint = 0, 2261 .lifetime = OperandLifeTime::CONSTANT_COPY, 2262 .location = {.poolIndex = 0, .offset = 56, .length = 4}, 2263 }, 2264 { 2265 .type = OperandType::BOOL, 2266 .dimensions = {}, 2267 .numberOfConsumers = 1, 2268 .scale = 0.0f, 2269 .zeroPoint = 0, 2270 .lifetime = OperandLifeTime::CONSTANT_COPY, 2271 .location = {.poolIndex = 0, .offset = 60, .length = 1}, 2272 }, 2273 { 2274 .type = OperandType::TENSOR_FLOAT16, 2275 .dimensions = {0, 2, 2, 1}, 2276 .numberOfConsumers = 1, 2277 .scale = 0.0f, 2278 .zeroPoint = 0, 2279 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, 2280 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2281 }, 2282 { 2283 .type = OperandType::TENSOR_QUANT8_ASYMM, 2284 .dimensions = {0, 0, 0, 0}, 2285 .numberOfConsumers = 0, 2286 .scale = 0.1f, 2287 .zeroPoint = 128, 2288 .lifetime = OperandLifeTime::MODEL_OUTPUT, 2289 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 2290 } 2291 }; 2292 2293 const std::vector<Operation> operations = { 2294 { 2295 .type = OperationType::BOX_WITH_NMS_LIMIT, 2296 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, 2297 .outputs = {9, 10, 11, 12}, 2298 }, 2299 { 2300 .type = OperationType::ROI_ALIGN, 2301 .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, 2302 .outputs = {21}, 2303 }, 2304 { 2305 .type = OperationType::QUANTIZE, 2306 .inputs = {21}, 2307 .outputs = {22}, 2308 } 2309 }; 2310 2311 const std::vector<uint32_t> inputIndexes = {13}; 2312 const std::vector<uint32_t> outputIndexes = {9, 11, 22}; 2313 std::vector<uint8_t> operandValues = { 2314 51, 59, 102, 46, 0, 60, 0, 60, 0, 73, 0, 73, 0, 0, 0, 0, 0, 73, 0, 73, 0, 0, 0, 0, 205, 52, 255, 255, 255, 255, 0, 0, 0, 0, 102, 54, 0, 60, 205, 52, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0 2315 }; 2316 const std::vector<hidl_memory> pools = {}; 2317 2318 return { 2319 .operands = operands, 2320 .operations = operations, 2321 .inputIndexes = inputIndexes, 2322 .outputIndexes = outputIndexes, 2323 .operandValues = operandValues, 2324 .pools = pools, 2325 }; 2326 } 2327 2328 inline bool is_ignored_zero_sized_dynamic_output_shape_float16(int i) { 2329 static std::set<int> ignore = {}; 2330 return ignore.find(i) != ignore.end(); 2331 } 2332 2333