1 // clang-format off 2 // Generated file (from: prelu.mod.py). Do not edit 3 // Create the model 4 Model createTestModel() { 5 const std::vector<Operand> operands = { 6 { 7 .type = OperandType::TENSOR_FLOAT32, 8 .dimensions = {1, 2, 2, 3}, 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_FLOAT32, 17 .dimensions = {1, 1, 3}, 18 .numberOfConsumers = 1, 19 .scale = 0.0f, 20 .zeroPoint = 0, 21 .lifetime = OperandLifeTime::CONSTANT_COPY, 22 .location = {.poolIndex = 0, .offset = 0, .length = 12}, 23 }, 24 { 25 .type = OperandType::TENSOR_FLOAT32, 26 .dimensions = {1, 2, 2, 3}, 27 .numberOfConsumers = 0, 28 .scale = 0.0f, 29 .zeroPoint = 0, 30 .lifetime = OperandLifeTime::MODEL_OUTPUT, 31 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 32 } 33 }; 34 35 const std::vector<Operation> operations = { 36 { 37 .type = OperationType::PRELU, 38 .inputs = {0, 1}, 39 .outputs = {2}, 40 } 41 }; 42 43 const std::vector<uint32_t> inputIndexes = {0}; 44 const std::vector<uint32_t> outputIndexes = {2}; 45 std::vector<uint8_t> operandValues = { 46 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 64 47 }; 48 const std::vector<hidl_memory> pools = {}; 49 50 return { 51 .operands = operands, 52 .operations = operations, 53 .inputIndexes = inputIndexes, 54 .outputIndexes = outputIndexes, 55 .operandValues = operandValues, 56 .pools = pools, 57 }; 58 } 59 60 inline bool is_ignored(int i) { 61 static std::set<int> ignore = {}; 62 return ignore.find(i) != ignore.end(); 63 } 64 65 // Create the model 66 Model createTestModel_relaxed() { 67 const std::vector<Operand> operands = { 68 { 69 .type = OperandType::TENSOR_FLOAT32, 70 .dimensions = {1, 2, 2, 3}, 71 .numberOfConsumers = 1, 72 .scale = 0.0f, 73 .zeroPoint = 0, 74 .lifetime = OperandLifeTime::MODEL_INPUT, 75 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 76 }, 77 { 78 .type = OperandType::TENSOR_FLOAT32, 79 .dimensions = {1, 1, 3}, 80 .numberOfConsumers = 1, 81 .scale = 0.0f, 82 .zeroPoint = 0, 83 .lifetime = OperandLifeTime::CONSTANT_COPY, 84 .location = {.poolIndex = 0, .offset = 0, .length = 12}, 85 }, 86 { 87 .type = OperandType::TENSOR_FLOAT32, 88 .dimensions = {1, 2, 2, 3}, 89 .numberOfConsumers = 0, 90 .scale = 0.0f, 91 .zeroPoint = 0, 92 .lifetime = OperandLifeTime::MODEL_OUTPUT, 93 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 94 } 95 }; 96 97 const std::vector<Operation> operations = { 98 { 99 .type = OperationType::PRELU, 100 .inputs = {0, 1}, 101 .outputs = {2}, 102 } 103 }; 104 105 const std::vector<uint32_t> inputIndexes = {0}; 106 const std::vector<uint32_t> outputIndexes = {2}; 107 std::vector<uint8_t> operandValues = { 108 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 64 109 }; 110 const std::vector<hidl_memory> pools = {}; 111 112 return { 113 .operands = operands, 114 .operations = operations, 115 .inputIndexes = inputIndexes, 116 .outputIndexes = outputIndexes, 117 .operandValues = operandValues, 118 .pools = pools, 119 .relaxComputationFloat32toFloat16 = true, 120 }; 121 } 122 123 inline bool is_ignored_relaxed(int i) { 124 static std::set<int> ignore = {}; 125 return ignore.find(i) != ignore.end(); 126 } 127 128 // Create the model 129 Model createTestModel_quant8() { 130 const std::vector<Operand> operands = { 131 { 132 .type = OperandType::TENSOR_QUANT8_ASYMM, 133 .dimensions = {1, 2, 2, 3}, 134 .numberOfConsumers = 1, 135 .scale = 0.25f, 136 .zeroPoint = 128, 137 .lifetime = OperandLifeTime::MODEL_INPUT, 138 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 139 }, 140 { 141 .type = OperandType::TENSOR_QUANT8_ASYMM, 142 .dimensions = {1, 1, 3}, 143 .numberOfConsumers = 1, 144 .scale = 0.25f, 145 .zeroPoint = 50, 146 .lifetime = OperandLifeTime::CONSTANT_COPY, 147 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 148 }, 149 { 150 .type = OperandType::TENSOR_QUANT8_ASYMM, 151 .dimensions = {1, 2, 2, 3}, 152 .numberOfConsumers = 0, 153 .scale = 0.5f, 154 .zeroPoint = 120, 155 .lifetime = OperandLifeTime::MODEL_OUTPUT, 156 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 157 } 158 }; 159 160 const std::vector<Operation> operations = { 161 { 162 .type = OperationType::PRELU, 163 .inputs = {0, 1}, 164 .outputs = {2}, 165 } 166 }; 167 168 const std::vector<uint32_t> inputIndexes = {0}; 169 const std::vector<uint32_t> outputIndexes = {2}; 170 std::vector<uint8_t> operandValues = { 171 50, 54, 58 172 }; 173 const std::vector<hidl_memory> pools = {}; 174 175 return { 176 .operands = operands, 177 .operations = operations, 178 .inputIndexes = inputIndexes, 179 .outputIndexes = outputIndexes, 180 .operandValues = operandValues, 181 .pools = pools, 182 }; 183 } 184 185 inline bool is_ignored_quant8(int i) { 186 static std::set<int> ignore = {}; 187 return ignore.find(i) != ignore.end(); 188 } 189 190 // Create the model 191 Model createTestModel_quant8_2() { 192 const std::vector<Operand> operands = { 193 { 194 .type = OperandType::TENSOR_QUANT8_ASYMM, 195 .dimensions = {1, 2, 2, 3}, 196 .numberOfConsumers = 1, 197 .scale = 0.25f, 198 .zeroPoint = 128, 199 .lifetime = OperandLifeTime::MODEL_INPUT, 200 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 201 }, 202 { 203 .type = OperandType::TENSOR_QUANT8_ASYMM, 204 .dimensions = {1, 1, 3}, 205 .numberOfConsumers = 1, 206 .scale = 0.25f, 207 .zeroPoint = 50, 208 .lifetime = OperandLifeTime::CONSTANT_COPY, 209 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 210 }, 211 { 212 .type = OperandType::TENSOR_QUANT8_ASYMM, 213 .dimensions = {1, 2, 2, 3}, 214 .numberOfConsumers = 0, 215 .scale = 0.25f, 216 .zeroPoint = 120, 217 .lifetime = OperandLifeTime::MODEL_OUTPUT, 218 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 219 } 220 }; 221 222 const std::vector<Operation> operations = { 223 { 224 .type = OperationType::PRELU, 225 .inputs = {0, 1}, 226 .outputs = {2}, 227 } 228 }; 229 230 const std::vector<uint32_t> inputIndexes = {0}; 231 const std::vector<uint32_t> outputIndexes = {2}; 232 std::vector<uint8_t> operandValues = { 233 50, 54, 58 234 }; 235 const std::vector<hidl_memory> pools = {}; 236 237 return { 238 .operands = operands, 239 .operations = operations, 240 .inputIndexes = inputIndexes, 241 .outputIndexes = outputIndexes, 242 .operandValues = operandValues, 243 .pools = pools, 244 }; 245 } 246 247 inline bool is_ignored_quant8_2(int i) { 248 static std::set<int> ignore = {}; 249 return ignore.find(i) != ignore.end(); 250 } 251 252 // Create the model 253 Model createTestModel_quant8_3() { 254 const std::vector<Operand> operands = { 255 { 256 .type = OperandType::TENSOR_QUANT8_ASYMM, 257 .dimensions = {1, 2, 2, 3}, 258 .numberOfConsumers = 1, 259 .scale = 0.25f, 260 .zeroPoint = 128, 261 .lifetime = OperandLifeTime::MODEL_INPUT, 262 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 263 }, 264 { 265 .type = OperandType::TENSOR_QUANT8_ASYMM, 266 .dimensions = {1, 1, 3}, 267 .numberOfConsumers = 1, 268 .scale = 0.5f, 269 .zeroPoint = 50, 270 .lifetime = OperandLifeTime::CONSTANT_COPY, 271 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 272 }, 273 { 274 .type = OperandType::TENSOR_QUANT8_ASYMM, 275 .dimensions = {1, 2, 2, 3}, 276 .numberOfConsumers = 0, 277 .scale = 0.125f, 278 .zeroPoint = 120, 279 .lifetime = OperandLifeTime::MODEL_OUTPUT, 280 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 281 } 282 }; 283 284 const std::vector<Operation> operations = { 285 { 286 .type = OperationType::PRELU, 287 .inputs = {0, 1}, 288 .outputs = {2}, 289 } 290 }; 291 292 const std::vector<uint32_t> inputIndexes = {0}; 293 const std::vector<uint32_t> outputIndexes = {2}; 294 std::vector<uint8_t> operandValues = { 295 50, 52, 54 296 }; 297 const std::vector<hidl_memory> pools = {}; 298 299 return { 300 .operands = operands, 301 .operations = operations, 302 .inputIndexes = inputIndexes, 303 .outputIndexes = outputIndexes, 304 .operandValues = operandValues, 305 .pools = pools, 306 }; 307 } 308 309 inline bool is_ignored_quant8_3(int i) { 310 static std::set<int> ignore = {}; 311 return ignore.find(i) != ignore.end(); 312 } 313 314 // Create the model 315 Model createTestModel_quant8_4() { 316 const std::vector<Operand> operands = { 317 { 318 .type = OperandType::TENSOR_QUANT8_ASYMM, 319 .dimensions = {1, 2, 2, 3}, 320 .numberOfConsumers = 1, 321 .scale = 0.25f, 322 .zeroPoint = 128, 323 .lifetime = OperandLifeTime::MODEL_INPUT, 324 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 325 }, 326 { 327 .type = OperandType::TENSOR_QUANT8_ASYMM, 328 .dimensions = {1, 1, 3}, 329 .numberOfConsumers = 1, 330 .scale = 0.5f, 331 .zeroPoint = 50, 332 .lifetime = OperandLifeTime::CONSTANT_COPY, 333 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 334 }, 335 { 336 .type = OperandType::TENSOR_QUANT8_ASYMM, 337 .dimensions = {1, 2, 2, 3}, 338 .numberOfConsumers = 0, 339 .scale = 0.1f, 340 .zeroPoint = 120, 341 .lifetime = OperandLifeTime::MODEL_OUTPUT, 342 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 343 } 344 }; 345 346 const std::vector<Operation> operations = { 347 { 348 .type = OperationType::PRELU, 349 .inputs = {0, 1}, 350 .outputs = {2}, 351 } 352 }; 353 354 const std::vector<uint32_t> inputIndexes = {0}; 355 const std::vector<uint32_t> outputIndexes = {2}; 356 std::vector<uint8_t> operandValues = { 357 50, 52, 54 358 }; 359 const std::vector<hidl_memory> pools = {}; 360 361 return { 362 .operands = operands, 363 .operations = operations, 364 .inputIndexes = inputIndexes, 365 .outputIndexes = outputIndexes, 366 .operandValues = operandValues, 367 .pools = pools, 368 }; 369 } 370 371 inline bool is_ignored_quant8_4(int i) { 372 static std::set<int> ignore = {}; 373 return ignore.find(i) != ignore.end(); 374 } 375 376 // Create the model 377 Model createTestModel_float16() { 378 const std::vector<Operand> operands = { 379 { 380 .type = OperandType::TENSOR_FLOAT16, 381 .dimensions = {1, 2, 2, 3}, 382 .numberOfConsumers = 1, 383 .scale = 0.0f, 384 .zeroPoint = 0, 385 .lifetime = OperandLifeTime::MODEL_INPUT, 386 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 387 }, 388 { 389 .type = OperandType::TENSOR_FLOAT16, 390 .dimensions = {1, 1, 3}, 391 .numberOfConsumers = 1, 392 .scale = 0.0f, 393 .zeroPoint = 0, 394 .lifetime = OperandLifeTime::CONSTANT_COPY, 395 .location = {.poolIndex = 0, .offset = 0, .length = 6}, 396 }, 397 { 398 .type = OperandType::TENSOR_FLOAT16, 399 .dimensions = {1, 2, 2, 3}, 400 .numberOfConsumers = 0, 401 .scale = 0.0f, 402 .zeroPoint = 0, 403 .lifetime = OperandLifeTime::MODEL_OUTPUT, 404 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 405 } 406 }; 407 408 const std::vector<Operation> operations = { 409 { 410 .type = OperationType::PRELU, 411 .inputs = {0, 1}, 412 .outputs = {2}, 413 } 414 }; 415 416 const std::vector<uint32_t> inputIndexes = {0}; 417 const std::vector<uint32_t> outputIndexes = {2}; 418 std::vector<uint8_t> operandValues = { 419 0, 0, 0, 60, 0, 64 420 }; 421 const std::vector<hidl_memory> pools = {}; 422 423 return { 424 .operands = operands, 425 .operations = operations, 426 .inputIndexes = inputIndexes, 427 .outputIndexes = outputIndexes, 428 .operandValues = operandValues, 429 .pools = pools, 430 }; 431 } 432 433 inline bool is_ignored_float16(int i) { 434 static std::set<int> ignore = {}; 435 return ignore.find(i) != ignore.end(); 436 } 437 438 // Create the model 439 Model createTestModel_weight_as_input() { 440 const std::vector<Operand> operands = { 441 { 442 .type = OperandType::TENSOR_FLOAT32, 443 .dimensions = {1, 2, 2, 3}, 444 .numberOfConsumers = 1, 445 .scale = 0.0f, 446 .zeroPoint = 0, 447 .lifetime = OperandLifeTime::MODEL_INPUT, 448 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 449 }, 450 { 451 .type = OperandType::TENSOR_FLOAT32, 452 .dimensions = {1, 1, 3}, 453 .numberOfConsumers = 1, 454 .scale = 0.0f, 455 .zeroPoint = 0, 456 .lifetime = OperandLifeTime::MODEL_INPUT, 457 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 458 }, 459 { 460 .type = OperandType::TENSOR_FLOAT32, 461 .dimensions = {1, 2, 2, 3}, 462 .numberOfConsumers = 0, 463 .scale = 0.0f, 464 .zeroPoint = 0, 465 .lifetime = OperandLifeTime::MODEL_OUTPUT, 466 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 467 } 468 }; 469 470 const std::vector<Operation> operations = { 471 { 472 .type = OperationType::PRELU, 473 .inputs = {0, 1}, 474 .outputs = {2}, 475 } 476 }; 477 478 const std::vector<uint32_t> inputIndexes = {0, 1}; 479 const std::vector<uint32_t> outputIndexes = {2}; 480 std::vector<uint8_t> operandValues = {}; 481 const std::vector<hidl_memory> pools = {}; 482 483 return { 484 .operands = operands, 485 .operations = operations, 486 .inputIndexes = inputIndexes, 487 .outputIndexes = outputIndexes, 488 .operandValues = operandValues, 489 .pools = pools, 490 }; 491 } 492 493 inline bool is_ignored_weight_as_input(int i) { 494 static std::set<int> ignore = {}; 495 return ignore.find(i) != ignore.end(); 496 } 497 498 // Create the model 499 Model createTestModel_weight_as_input_relaxed() { 500 const std::vector<Operand> operands = { 501 { 502 .type = OperandType::TENSOR_FLOAT32, 503 .dimensions = {1, 2, 2, 3}, 504 .numberOfConsumers = 1, 505 .scale = 0.0f, 506 .zeroPoint = 0, 507 .lifetime = OperandLifeTime::MODEL_INPUT, 508 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 509 }, 510 { 511 .type = OperandType::TENSOR_FLOAT32, 512 .dimensions = {1, 1, 3}, 513 .numberOfConsumers = 1, 514 .scale = 0.0f, 515 .zeroPoint = 0, 516 .lifetime = OperandLifeTime::MODEL_INPUT, 517 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 518 }, 519 { 520 .type = OperandType::TENSOR_FLOAT32, 521 .dimensions = {1, 2, 2, 3}, 522 .numberOfConsumers = 0, 523 .scale = 0.0f, 524 .zeroPoint = 0, 525 .lifetime = OperandLifeTime::MODEL_OUTPUT, 526 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 527 } 528 }; 529 530 const std::vector<Operation> operations = { 531 { 532 .type = OperationType::PRELU, 533 .inputs = {0, 1}, 534 .outputs = {2}, 535 } 536 }; 537 538 const std::vector<uint32_t> inputIndexes = {0, 1}; 539 const std::vector<uint32_t> outputIndexes = {2}; 540 std::vector<uint8_t> operandValues = {}; 541 const std::vector<hidl_memory> pools = {}; 542 543 return { 544 .operands = operands, 545 .operations = operations, 546 .inputIndexes = inputIndexes, 547 .outputIndexes = outputIndexes, 548 .operandValues = operandValues, 549 .pools = pools, 550 .relaxComputationFloat32toFloat16 = true, 551 }; 552 } 553 554 inline bool is_ignored_weight_as_input_relaxed(int i) { 555 static std::set<int> ignore = {}; 556 return ignore.find(i) != ignore.end(); 557 } 558 559 // Create the model 560 Model createTestModel_weight_as_input_quant8() { 561 const std::vector<Operand> operands = { 562 { 563 .type = OperandType::TENSOR_QUANT8_ASYMM, 564 .dimensions = {1, 2, 2, 3}, 565 .numberOfConsumers = 1, 566 .scale = 0.25f, 567 .zeroPoint = 128, 568 .lifetime = OperandLifeTime::MODEL_INPUT, 569 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 570 }, 571 { 572 .type = OperandType::TENSOR_QUANT8_ASYMM, 573 .dimensions = {1, 1, 3}, 574 .numberOfConsumers = 1, 575 .scale = 0.25f, 576 .zeroPoint = 50, 577 .lifetime = OperandLifeTime::MODEL_INPUT, 578 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 579 }, 580 { 581 .type = OperandType::TENSOR_QUANT8_ASYMM, 582 .dimensions = {1, 2, 2, 3}, 583 .numberOfConsumers = 0, 584 .scale = 0.5f, 585 .zeroPoint = 120, 586 .lifetime = OperandLifeTime::MODEL_OUTPUT, 587 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 588 } 589 }; 590 591 const std::vector<Operation> operations = { 592 { 593 .type = OperationType::PRELU, 594 .inputs = {0, 1}, 595 .outputs = {2}, 596 } 597 }; 598 599 const std::vector<uint32_t> inputIndexes = {0, 1}; 600 const std::vector<uint32_t> outputIndexes = {2}; 601 std::vector<uint8_t> operandValues = {}; 602 const std::vector<hidl_memory> pools = {}; 603 604 return { 605 .operands = operands, 606 .operations = operations, 607 .inputIndexes = inputIndexes, 608 .outputIndexes = outputIndexes, 609 .operandValues = operandValues, 610 .pools = pools, 611 }; 612 } 613 614 inline bool is_ignored_weight_as_input_quant8(int i) { 615 static std::set<int> ignore = {}; 616 return ignore.find(i) != ignore.end(); 617 } 618 619 // Create the model 620 Model createTestModel_weight_as_input_quant8_2() { 621 const std::vector<Operand> operands = { 622 { 623 .type = OperandType::TENSOR_QUANT8_ASYMM, 624 .dimensions = {1, 2, 2, 3}, 625 .numberOfConsumers = 1, 626 .scale = 0.25f, 627 .zeroPoint = 128, 628 .lifetime = OperandLifeTime::MODEL_INPUT, 629 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 630 }, 631 { 632 .type = OperandType::TENSOR_QUANT8_ASYMM, 633 .dimensions = {1, 1, 3}, 634 .numberOfConsumers = 1, 635 .scale = 0.25f, 636 .zeroPoint = 50, 637 .lifetime = OperandLifeTime::MODEL_INPUT, 638 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 639 }, 640 { 641 .type = OperandType::TENSOR_QUANT8_ASYMM, 642 .dimensions = {1, 2, 2, 3}, 643 .numberOfConsumers = 0, 644 .scale = 0.25f, 645 .zeroPoint = 120, 646 .lifetime = OperandLifeTime::MODEL_OUTPUT, 647 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 648 } 649 }; 650 651 const std::vector<Operation> operations = { 652 { 653 .type = OperationType::PRELU, 654 .inputs = {0, 1}, 655 .outputs = {2}, 656 } 657 }; 658 659 const std::vector<uint32_t> inputIndexes = {0, 1}; 660 const std::vector<uint32_t> outputIndexes = {2}; 661 std::vector<uint8_t> operandValues = {}; 662 const std::vector<hidl_memory> pools = {}; 663 664 return { 665 .operands = operands, 666 .operations = operations, 667 .inputIndexes = inputIndexes, 668 .outputIndexes = outputIndexes, 669 .operandValues = operandValues, 670 .pools = pools, 671 }; 672 } 673 674 inline bool is_ignored_weight_as_input_quant8_2(int i) { 675 static std::set<int> ignore = {}; 676 return ignore.find(i) != ignore.end(); 677 } 678 679 // Create the model 680 Model createTestModel_weight_as_input_quant8_3() { 681 const std::vector<Operand> operands = { 682 { 683 .type = OperandType::TENSOR_QUANT8_ASYMM, 684 .dimensions = {1, 2, 2, 3}, 685 .numberOfConsumers = 1, 686 .scale = 0.25f, 687 .zeroPoint = 128, 688 .lifetime = OperandLifeTime::MODEL_INPUT, 689 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 690 }, 691 { 692 .type = OperandType::TENSOR_QUANT8_ASYMM, 693 .dimensions = {1, 1, 3}, 694 .numberOfConsumers = 1, 695 .scale = 0.5f, 696 .zeroPoint = 50, 697 .lifetime = OperandLifeTime::MODEL_INPUT, 698 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 699 }, 700 { 701 .type = OperandType::TENSOR_QUANT8_ASYMM, 702 .dimensions = {1, 2, 2, 3}, 703 .numberOfConsumers = 0, 704 .scale = 0.125f, 705 .zeroPoint = 120, 706 .lifetime = OperandLifeTime::MODEL_OUTPUT, 707 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 708 } 709 }; 710 711 const std::vector<Operation> operations = { 712 { 713 .type = OperationType::PRELU, 714 .inputs = {0, 1}, 715 .outputs = {2}, 716 } 717 }; 718 719 const std::vector<uint32_t> inputIndexes = {0, 1}; 720 const std::vector<uint32_t> outputIndexes = {2}; 721 std::vector<uint8_t> operandValues = {}; 722 const std::vector<hidl_memory> pools = {}; 723 724 return { 725 .operands = operands, 726 .operations = operations, 727 .inputIndexes = inputIndexes, 728 .outputIndexes = outputIndexes, 729 .operandValues = operandValues, 730 .pools = pools, 731 }; 732 } 733 734 inline bool is_ignored_weight_as_input_quant8_3(int i) { 735 static std::set<int> ignore = {}; 736 return ignore.find(i) != ignore.end(); 737 } 738 739 // Create the model 740 Model createTestModel_weight_as_input_quant8_4() { 741 const std::vector<Operand> operands = { 742 { 743 .type = OperandType::TENSOR_QUANT8_ASYMM, 744 .dimensions = {1, 2, 2, 3}, 745 .numberOfConsumers = 1, 746 .scale = 0.25f, 747 .zeroPoint = 128, 748 .lifetime = OperandLifeTime::MODEL_INPUT, 749 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 750 }, 751 { 752 .type = OperandType::TENSOR_QUANT8_ASYMM, 753 .dimensions = {1, 1, 3}, 754 .numberOfConsumers = 1, 755 .scale = 0.5f, 756 .zeroPoint = 50, 757 .lifetime = OperandLifeTime::MODEL_INPUT, 758 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 759 }, 760 { 761 .type = OperandType::TENSOR_QUANT8_ASYMM, 762 .dimensions = {1, 2, 2, 3}, 763 .numberOfConsumers = 0, 764 .scale = 0.1f, 765 .zeroPoint = 120, 766 .lifetime = OperandLifeTime::MODEL_OUTPUT, 767 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 768 } 769 }; 770 771 const std::vector<Operation> operations = { 772 { 773 .type = OperationType::PRELU, 774 .inputs = {0, 1}, 775 .outputs = {2}, 776 } 777 }; 778 779 const std::vector<uint32_t> inputIndexes = {0, 1}; 780 const std::vector<uint32_t> outputIndexes = {2}; 781 std::vector<uint8_t> operandValues = {}; 782 const std::vector<hidl_memory> pools = {}; 783 784 return { 785 .operands = operands, 786 .operations = operations, 787 .inputIndexes = inputIndexes, 788 .outputIndexes = outputIndexes, 789 .operandValues = operandValues, 790 .pools = pools, 791 }; 792 } 793 794 inline bool is_ignored_weight_as_input_quant8_4(int i) { 795 static std::set<int> ignore = {}; 796 return ignore.find(i) != ignore.end(); 797 } 798 799 // Create the model 800 Model createTestModel_weight_as_input_float16() { 801 const std::vector<Operand> operands = { 802 { 803 .type = OperandType::TENSOR_FLOAT16, 804 .dimensions = {1, 2, 2, 3}, 805 .numberOfConsumers = 1, 806 .scale = 0.0f, 807 .zeroPoint = 0, 808 .lifetime = OperandLifeTime::MODEL_INPUT, 809 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 810 }, 811 { 812 .type = OperandType::TENSOR_FLOAT16, 813 .dimensions = {1, 1, 3}, 814 .numberOfConsumers = 1, 815 .scale = 0.0f, 816 .zeroPoint = 0, 817 .lifetime = OperandLifeTime::MODEL_INPUT, 818 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 819 }, 820 { 821 .type = OperandType::TENSOR_FLOAT16, 822 .dimensions = {1, 2, 2, 3}, 823 .numberOfConsumers = 0, 824 .scale = 0.0f, 825 .zeroPoint = 0, 826 .lifetime = OperandLifeTime::MODEL_OUTPUT, 827 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 828 } 829 }; 830 831 const std::vector<Operation> operations = { 832 { 833 .type = OperationType::PRELU, 834 .inputs = {0, 1}, 835 .outputs = {2}, 836 } 837 }; 838 839 const std::vector<uint32_t> inputIndexes = {0, 1}; 840 const std::vector<uint32_t> outputIndexes = {2}; 841 std::vector<uint8_t> operandValues = {}; 842 const std::vector<hidl_memory> pools = {}; 843 844 return { 845 .operands = operands, 846 .operations = operations, 847 .inputIndexes = inputIndexes, 848 .outputIndexes = outputIndexes, 849 .operandValues = operandValues, 850 .pools = pools, 851 }; 852 } 853 854 inline bool is_ignored_weight_as_input_float16(int i) { 855 static std::set<int> ignore = {}; 856 return ignore.find(i) != ignore.end(); 857 } 858 859 // Create the model 860 Model createTestModel_dynamic_output_shape() { 861 const std::vector<Operand> operands = { 862 { 863 .type = OperandType::TENSOR_FLOAT32, 864 .dimensions = {1, 2, 2, 3}, 865 .numberOfConsumers = 1, 866 .scale = 0.0f, 867 .zeroPoint = 0, 868 .lifetime = OperandLifeTime::MODEL_INPUT, 869 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 870 }, 871 { 872 .type = OperandType::TENSOR_FLOAT32, 873 .dimensions = {1, 1, 3}, 874 .numberOfConsumers = 1, 875 .scale = 0.0f, 876 .zeroPoint = 0, 877 .lifetime = OperandLifeTime::CONSTANT_COPY, 878 .location = {.poolIndex = 0, .offset = 0, .length = 12}, 879 }, 880 { 881 .type = OperandType::TENSOR_FLOAT32, 882 .dimensions = {0, 0, 0, 0}, 883 .numberOfConsumers = 0, 884 .scale = 0.0f, 885 .zeroPoint = 0, 886 .lifetime = OperandLifeTime::MODEL_OUTPUT, 887 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 888 } 889 }; 890 891 const std::vector<Operation> operations = { 892 { 893 .type = OperationType::PRELU, 894 .inputs = {0, 1}, 895 .outputs = {2}, 896 } 897 }; 898 899 const std::vector<uint32_t> inputIndexes = {0}; 900 const std::vector<uint32_t> outputIndexes = {2}; 901 std::vector<uint8_t> operandValues = { 902 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 64 903 }; 904 const std::vector<hidl_memory> pools = {}; 905 906 return { 907 .operands = operands, 908 .operations = operations, 909 .inputIndexes = inputIndexes, 910 .outputIndexes = outputIndexes, 911 .operandValues = operandValues, 912 .pools = pools, 913 }; 914 } 915 916 inline bool is_ignored_dynamic_output_shape(int i) { 917 static std::set<int> ignore = {}; 918 return ignore.find(i) != ignore.end(); 919 } 920 921 // Create the model 922 Model createTestModel_dynamic_output_shape_relaxed() { 923 const std::vector<Operand> operands = { 924 { 925 .type = OperandType::TENSOR_FLOAT32, 926 .dimensions = {1, 2, 2, 3}, 927 .numberOfConsumers = 1, 928 .scale = 0.0f, 929 .zeroPoint = 0, 930 .lifetime = OperandLifeTime::MODEL_INPUT, 931 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 932 }, 933 { 934 .type = OperandType::TENSOR_FLOAT32, 935 .dimensions = {1, 1, 3}, 936 .numberOfConsumers = 1, 937 .scale = 0.0f, 938 .zeroPoint = 0, 939 .lifetime = OperandLifeTime::CONSTANT_COPY, 940 .location = {.poolIndex = 0, .offset = 0, .length = 12}, 941 }, 942 { 943 .type = OperandType::TENSOR_FLOAT32, 944 .dimensions = {0, 0, 0, 0}, 945 .numberOfConsumers = 0, 946 .scale = 0.0f, 947 .zeroPoint = 0, 948 .lifetime = OperandLifeTime::MODEL_OUTPUT, 949 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 950 } 951 }; 952 953 const std::vector<Operation> operations = { 954 { 955 .type = OperationType::PRELU, 956 .inputs = {0, 1}, 957 .outputs = {2}, 958 } 959 }; 960 961 const std::vector<uint32_t> inputIndexes = {0}; 962 const std::vector<uint32_t> outputIndexes = {2}; 963 std::vector<uint8_t> operandValues = { 964 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 64 965 }; 966 const std::vector<hidl_memory> pools = {}; 967 968 return { 969 .operands = operands, 970 .operations = operations, 971 .inputIndexes = inputIndexes, 972 .outputIndexes = outputIndexes, 973 .operandValues = operandValues, 974 .pools = pools, 975 .relaxComputationFloat32toFloat16 = true, 976 }; 977 } 978 979 inline bool is_ignored_dynamic_output_shape_relaxed(int i) { 980 static std::set<int> ignore = {}; 981 return ignore.find(i) != ignore.end(); 982 } 983 984 // Create the model 985 Model createTestModel_dynamic_output_shape_quant8() { 986 const std::vector<Operand> operands = { 987 { 988 .type = OperandType::TENSOR_QUANT8_ASYMM, 989 .dimensions = {1, 2, 2, 3}, 990 .numberOfConsumers = 1, 991 .scale = 0.25f, 992 .zeroPoint = 128, 993 .lifetime = OperandLifeTime::MODEL_INPUT, 994 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 995 }, 996 { 997 .type = OperandType::TENSOR_QUANT8_ASYMM, 998 .dimensions = {1, 1, 3}, 999 .numberOfConsumers = 1, 1000 .scale = 0.25f, 1001 .zeroPoint = 50, 1002 .lifetime = OperandLifeTime::CONSTANT_COPY, 1003 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 1004 }, 1005 { 1006 .type = OperandType::TENSOR_QUANT8_ASYMM, 1007 .dimensions = {0, 0, 0, 0}, 1008 .numberOfConsumers = 0, 1009 .scale = 0.5f, 1010 .zeroPoint = 120, 1011 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1012 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1013 } 1014 }; 1015 1016 const std::vector<Operation> operations = { 1017 { 1018 .type = OperationType::PRELU, 1019 .inputs = {0, 1}, 1020 .outputs = {2}, 1021 } 1022 }; 1023 1024 const std::vector<uint32_t> inputIndexes = {0}; 1025 const std::vector<uint32_t> outputIndexes = {2}; 1026 std::vector<uint8_t> operandValues = { 1027 50, 54, 58 1028 }; 1029 const std::vector<hidl_memory> pools = {}; 1030 1031 return { 1032 .operands = operands, 1033 .operations = operations, 1034 .inputIndexes = inputIndexes, 1035 .outputIndexes = outputIndexes, 1036 .operandValues = operandValues, 1037 .pools = pools, 1038 }; 1039 } 1040 1041 inline bool is_ignored_dynamic_output_shape_quant8(int i) { 1042 static std::set<int> ignore = {}; 1043 return ignore.find(i) != ignore.end(); 1044 } 1045 1046 // Create the model 1047 Model createTestModel_dynamic_output_shape_quant8_2() { 1048 const std::vector<Operand> operands = { 1049 { 1050 .type = OperandType::TENSOR_QUANT8_ASYMM, 1051 .dimensions = {1, 2, 2, 3}, 1052 .numberOfConsumers = 1, 1053 .scale = 0.25f, 1054 .zeroPoint = 128, 1055 .lifetime = OperandLifeTime::MODEL_INPUT, 1056 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1057 }, 1058 { 1059 .type = OperandType::TENSOR_QUANT8_ASYMM, 1060 .dimensions = {1, 1, 3}, 1061 .numberOfConsumers = 1, 1062 .scale = 0.25f, 1063 .zeroPoint = 50, 1064 .lifetime = OperandLifeTime::CONSTANT_COPY, 1065 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 1066 }, 1067 { 1068 .type = OperandType::TENSOR_QUANT8_ASYMM, 1069 .dimensions = {0, 0, 0, 0}, 1070 .numberOfConsumers = 0, 1071 .scale = 0.25f, 1072 .zeroPoint = 120, 1073 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1074 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1075 } 1076 }; 1077 1078 const std::vector<Operation> operations = { 1079 { 1080 .type = OperationType::PRELU, 1081 .inputs = {0, 1}, 1082 .outputs = {2}, 1083 } 1084 }; 1085 1086 const std::vector<uint32_t> inputIndexes = {0}; 1087 const std::vector<uint32_t> outputIndexes = {2}; 1088 std::vector<uint8_t> operandValues = { 1089 50, 54, 58 1090 }; 1091 const std::vector<hidl_memory> pools = {}; 1092 1093 return { 1094 .operands = operands, 1095 .operations = operations, 1096 .inputIndexes = inputIndexes, 1097 .outputIndexes = outputIndexes, 1098 .operandValues = operandValues, 1099 .pools = pools, 1100 }; 1101 } 1102 1103 inline bool is_ignored_dynamic_output_shape_quant8_2(int i) { 1104 static std::set<int> ignore = {}; 1105 return ignore.find(i) != ignore.end(); 1106 } 1107 1108 // Create the model 1109 Model createTestModel_dynamic_output_shape_quant8_3() { 1110 const std::vector<Operand> operands = { 1111 { 1112 .type = OperandType::TENSOR_QUANT8_ASYMM, 1113 .dimensions = {1, 2, 2, 3}, 1114 .numberOfConsumers = 1, 1115 .scale = 0.25f, 1116 .zeroPoint = 128, 1117 .lifetime = OperandLifeTime::MODEL_INPUT, 1118 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1119 }, 1120 { 1121 .type = OperandType::TENSOR_QUANT8_ASYMM, 1122 .dimensions = {1, 1, 3}, 1123 .numberOfConsumers = 1, 1124 .scale = 0.5f, 1125 .zeroPoint = 50, 1126 .lifetime = OperandLifeTime::CONSTANT_COPY, 1127 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 1128 }, 1129 { 1130 .type = OperandType::TENSOR_QUANT8_ASYMM, 1131 .dimensions = {0, 0, 0, 0}, 1132 .numberOfConsumers = 0, 1133 .scale = 0.125f, 1134 .zeroPoint = 120, 1135 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1136 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1137 } 1138 }; 1139 1140 const std::vector<Operation> operations = { 1141 { 1142 .type = OperationType::PRELU, 1143 .inputs = {0, 1}, 1144 .outputs = {2}, 1145 } 1146 }; 1147 1148 const std::vector<uint32_t> inputIndexes = {0}; 1149 const std::vector<uint32_t> outputIndexes = {2}; 1150 std::vector<uint8_t> operandValues = { 1151 50, 52, 54 1152 }; 1153 const std::vector<hidl_memory> pools = {}; 1154 1155 return { 1156 .operands = operands, 1157 .operations = operations, 1158 .inputIndexes = inputIndexes, 1159 .outputIndexes = outputIndexes, 1160 .operandValues = operandValues, 1161 .pools = pools, 1162 }; 1163 } 1164 1165 inline bool is_ignored_dynamic_output_shape_quant8_3(int i) { 1166 static std::set<int> ignore = {}; 1167 return ignore.find(i) != ignore.end(); 1168 } 1169 1170 // Create the model 1171 Model createTestModel_dynamic_output_shape_quant8_4() { 1172 const std::vector<Operand> operands = { 1173 { 1174 .type = OperandType::TENSOR_QUANT8_ASYMM, 1175 .dimensions = {1, 2, 2, 3}, 1176 .numberOfConsumers = 1, 1177 .scale = 0.25f, 1178 .zeroPoint = 128, 1179 .lifetime = OperandLifeTime::MODEL_INPUT, 1180 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1181 }, 1182 { 1183 .type = OperandType::TENSOR_QUANT8_ASYMM, 1184 .dimensions = {1, 1, 3}, 1185 .numberOfConsumers = 1, 1186 .scale = 0.5f, 1187 .zeroPoint = 50, 1188 .lifetime = OperandLifeTime::CONSTANT_COPY, 1189 .location = {.poolIndex = 0, .offset = 0, .length = 3}, 1190 }, 1191 { 1192 .type = OperandType::TENSOR_QUANT8_ASYMM, 1193 .dimensions = {0, 0, 0, 0}, 1194 .numberOfConsumers = 0, 1195 .scale = 0.1f, 1196 .zeroPoint = 120, 1197 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1198 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1199 } 1200 }; 1201 1202 const std::vector<Operation> operations = { 1203 { 1204 .type = OperationType::PRELU, 1205 .inputs = {0, 1}, 1206 .outputs = {2}, 1207 } 1208 }; 1209 1210 const std::vector<uint32_t> inputIndexes = {0}; 1211 const std::vector<uint32_t> outputIndexes = {2}; 1212 std::vector<uint8_t> operandValues = { 1213 50, 52, 54 1214 }; 1215 const std::vector<hidl_memory> pools = {}; 1216 1217 return { 1218 .operands = operands, 1219 .operations = operations, 1220 .inputIndexes = inputIndexes, 1221 .outputIndexes = outputIndexes, 1222 .operandValues = operandValues, 1223 .pools = pools, 1224 }; 1225 } 1226 1227 inline bool is_ignored_dynamic_output_shape_quant8_4(int i) { 1228 static std::set<int> ignore = {}; 1229 return ignore.find(i) != ignore.end(); 1230 } 1231 1232 // Create the model 1233 Model createTestModel_dynamic_output_shape_float16() { 1234 const std::vector<Operand> operands = { 1235 { 1236 .type = OperandType::TENSOR_FLOAT16, 1237 .dimensions = {1, 2, 2, 3}, 1238 .numberOfConsumers = 1, 1239 .scale = 0.0f, 1240 .zeroPoint = 0, 1241 .lifetime = OperandLifeTime::MODEL_INPUT, 1242 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1243 }, 1244 { 1245 .type = OperandType::TENSOR_FLOAT16, 1246 .dimensions = {1, 1, 3}, 1247 .numberOfConsumers = 1, 1248 .scale = 0.0f, 1249 .zeroPoint = 0, 1250 .lifetime = OperandLifeTime::CONSTANT_COPY, 1251 .location = {.poolIndex = 0, .offset = 0, .length = 6}, 1252 }, 1253 { 1254 .type = OperandType::TENSOR_FLOAT16, 1255 .dimensions = {0, 0, 0, 0}, 1256 .numberOfConsumers = 0, 1257 .scale = 0.0f, 1258 .zeroPoint = 0, 1259 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1260 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1261 } 1262 }; 1263 1264 const std::vector<Operation> operations = { 1265 { 1266 .type = OperationType::PRELU, 1267 .inputs = {0, 1}, 1268 .outputs = {2}, 1269 } 1270 }; 1271 1272 const std::vector<uint32_t> inputIndexes = {0}; 1273 const std::vector<uint32_t> outputIndexes = {2}; 1274 std::vector<uint8_t> operandValues = { 1275 0, 0, 0, 60, 0, 64 1276 }; 1277 const std::vector<hidl_memory> pools = {}; 1278 1279 return { 1280 .operands = operands, 1281 .operations = operations, 1282 .inputIndexes = inputIndexes, 1283 .outputIndexes = outputIndexes, 1284 .operandValues = operandValues, 1285 .pools = pools, 1286 }; 1287 } 1288 1289 inline bool is_ignored_dynamic_output_shape_float16(int i) { 1290 static std::set<int> ignore = {}; 1291 return ignore.find(i) != ignore.end(); 1292 } 1293 1294 // Create the model 1295 Model createTestModel_dynamic_output_shape_weight_as_input() { 1296 const std::vector<Operand> operands = { 1297 { 1298 .type = OperandType::TENSOR_FLOAT32, 1299 .dimensions = {1, 2, 2, 3}, 1300 .numberOfConsumers = 1, 1301 .scale = 0.0f, 1302 .zeroPoint = 0, 1303 .lifetime = OperandLifeTime::MODEL_INPUT, 1304 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1305 }, 1306 { 1307 .type = OperandType::TENSOR_FLOAT32, 1308 .dimensions = {1, 1, 3}, 1309 .numberOfConsumers = 1, 1310 .scale = 0.0f, 1311 .zeroPoint = 0, 1312 .lifetime = OperandLifeTime::MODEL_INPUT, 1313 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1314 }, 1315 { 1316 .type = OperandType::TENSOR_FLOAT32, 1317 .dimensions = {0, 0, 0, 0}, 1318 .numberOfConsumers = 0, 1319 .scale = 0.0f, 1320 .zeroPoint = 0, 1321 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1322 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1323 } 1324 }; 1325 1326 const std::vector<Operation> operations = { 1327 { 1328 .type = OperationType::PRELU, 1329 .inputs = {0, 1}, 1330 .outputs = {2}, 1331 } 1332 }; 1333 1334 const std::vector<uint32_t> inputIndexes = {0, 1}; 1335 const std::vector<uint32_t> outputIndexes = {2}; 1336 std::vector<uint8_t> operandValues = {}; 1337 const std::vector<hidl_memory> pools = {}; 1338 1339 return { 1340 .operands = operands, 1341 .operations = operations, 1342 .inputIndexes = inputIndexes, 1343 .outputIndexes = outputIndexes, 1344 .operandValues = operandValues, 1345 .pools = pools, 1346 }; 1347 } 1348 1349 inline bool is_ignored_dynamic_output_shape_weight_as_input(int i) { 1350 static std::set<int> ignore = {}; 1351 return ignore.find(i) != ignore.end(); 1352 } 1353 1354 // Create the model 1355 Model createTestModel_dynamic_output_shape_weight_as_input_relaxed() { 1356 const std::vector<Operand> operands = { 1357 { 1358 .type = OperandType::TENSOR_FLOAT32, 1359 .dimensions = {1, 2, 2, 3}, 1360 .numberOfConsumers = 1, 1361 .scale = 0.0f, 1362 .zeroPoint = 0, 1363 .lifetime = OperandLifeTime::MODEL_INPUT, 1364 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1365 }, 1366 { 1367 .type = OperandType::TENSOR_FLOAT32, 1368 .dimensions = {1, 1, 3}, 1369 .numberOfConsumers = 1, 1370 .scale = 0.0f, 1371 .zeroPoint = 0, 1372 .lifetime = OperandLifeTime::MODEL_INPUT, 1373 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1374 }, 1375 { 1376 .type = OperandType::TENSOR_FLOAT32, 1377 .dimensions = {0, 0, 0, 0}, 1378 .numberOfConsumers = 0, 1379 .scale = 0.0f, 1380 .zeroPoint = 0, 1381 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1382 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1383 } 1384 }; 1385 1386 const std::vector<Operation> operations = { 1387 { 1388 .type = OperationType::PRELU, 1389 .inputs = {0, 1}, 1390 .outputs = {2}, 1391 } 1392 }; 1393 1394 const std::vector<uint32_t> inputIndexes = {0, 1}; 1395 const std::vector<uint32_t> outputIndexes = {2}; 1396 std::vector<uint8_t> operandValues = {}; 1397 const std::vector<hidl_memory> pools = {}; 1398 1399 return { 1400 .operands = operands, 1401 .operations = operations, 1402 .inputIndexes = inputIndexes, 1403 .outputIndexes = outputIndexes, 1404 .operandValues = operandValues, 1405 .pools = pools, 1406 .relaxComputationFloat32toFloat16 = true, 1407 }; 1408 } 1409 1410 inline bool is_ignored_dynamic_output_shape_weight_as_input_relaxed(int i) { 1411 static std::set<int> ignore = {}; 1412 return ignore.find(i) != ignore.end(); 1413 } 1414 1415 // Create the model 1416 Model createTestModel_dynamic_output_shape_weight_as_input_quant8() { 1417 const std::vector<Operand> operands = { 1418 { 1419 .type = OperandType::TENSOR_QUANT8_ASYMM, 1420 .dimensions = {1, 2, 2, 3}, 1421 .numberOfConsumers = 1, 1422 .scale = 0.25f, 1423 .zeroPoint = 128, 1424 .lifetime = OperandLifeTime::MODEL_INPUT, 1425 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1426 }, 1427 { 1428 .type = OperandType::TENSOR_QUANT8_ASYMM, 1429 .dimensions = {1, 1, 3}, 1430 .numberOfConsumers = 1, 1431 .scale = 0.25f, 1432 .zeroPoint = 50, 1433 .lifetime = OperandLifeTime::MODEL_INPUT, 1434 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1435 }, 1436 { 1437 .type = OperandType::TENSOR_QUANT8_ASYMM, 1438 .dimensions = {0, 0, 0, 0}, 1439 .numberOfConsumers = 0, 1440 .scale = 0.5f, 1441 .zeroPoint = 120, 1442 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1443 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1444 } 1445 }; 1446 1447 const std::vector<Operation> operations = { 1448 { 1449 .type = OperationType::PRELU, 1450 .inputs = {0, 1}, 1451 .outputs = {2}, 1452 } 1453 }; 1454 1455 const std::vector<uint32_t> inputIndexes = {0, 1}; 1456 const std::vector<uint32_t> outputIndexes = {2}; 1457 std::vector<uint8_t> operandValues = {}; 1458 const std::vector<hidl_memory> pools = {}; 1459 1460 return { 1461 .operands = operands, 1462 .operations = operations, 1463 .inputIndexes = inputIndexes, 1464 .outputIndexes = outputIndexes, 1465 .operandValues = operandValues, 1466 .pools = pools, 1467 }; 1468 } 1469 1470 inline bool is_ignored_dynamic_output_shape_weight_as_input_quant8(int i) { 1471 static std::set<int> ignore = {}; 1472 return ignore.find(i) != ignore.end(); 1473 } 1474 1475 // Create the model 1476 Model createTestModel_dynamic_output_shape_weight_as_input_quant8_2() { 1477 const std::vector<Operand> operands = { 1478 { 1479 .type = OperandType::TENSOR_QUANT8_ASYMM, 1480 .dimensions = {1, 2, 2, 3}, 1481 .numberOfConsumers = 1, 1482 .scale = 0.25f, 1483 .zeroPoint = 128, 1484 .lifetime = OperandLifeTime::MODEL_INPUT, 1485 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1486 }, 1487 { 1488 .type = OperandType::TENSOR_QUANT8_ASYMM, 1489 .dimensions = {1, 1, 3}, 1490 .numberOfConsumers = 1, 1491 .scale = 0.25f, 1492 .zeroPoint = 50, 1493 .lifetime = OperandLifeTime::MODEL_INPUT, 1494 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1495 }, 1496 { 1497 .type = OperandType::TENSOR_QUANT8_ASYMM, 1498 .dimensions = {0, 0, 0, 0}, 1499 .numberOfConsumers = 0, 1500 .scale = 0.25f, 1501 .zeroPoint = 120, 1502 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1503 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1504 } 1505 }; 1506 1507 const std::vector<Operation> operations = { 1508 { 1509 .type = OperationType::PRELU, 1510 .inputs = {0, 1}, 1511 .outputs = {2}, 1512 } 1513 }; 1514 1515 const std::vector<uint32_t> inputIndexes = {0, 1}; 1516 const std::vector<uint32_t> outputIndexes = {2}; 1517 std::vector<uint8_t> operandValues = {}; 1518 const std::vector<hidl_memory> pools = {}; 1519 1520 return { 1521 .operands = operands, 1522 .operations = operations, 1523 .inputIndexes = inputIndexes, 1524 .outputIndexes = outputIndexes, 1525 .operandValues = operandValues, 1526 .pools = pools, 1527 }; 1528 } 1529 1530 inline bool is_ignored_dynamic_output_shape_weight_as_input_quant8_2(int i) { 1531 static std::set<int> ignore = {}; 1532 return ignore.find(i) != ignore.end(); 1533 } 1534 1535 // Create the model 1536 Model createTestModel_dynamic_output_shape_weight_as_input_quant8_3() { 1537 const std::vector<Operand> operands = { 1538 { 1539 .type = OperandType::TENSOR_QUANT8_ASYMM, 1540 .dimensions = {1, 2, 2, 3}, 1541 .numberOfConsumers = 1, 1542 .scale = 0.25f, 1543 .zeroPoint = 128, 1544 .lifetime = OperandLifeTime::MODEL_INPUT, 1545 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1546 }, 1547 { 1548 .type = OperandType::TENSOR_QUANT8_ASYMM, 1549 .dimensions = {1, 1, 3}, 1550 .numberOfConsumers = 1, 1551 .scale = 0.5f, 1552 .zeroPoint = 50, 1553 .lifetime = OperandLifeTime::MODEL_INPUT, 1554 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1555 }, 1556 { 1557 .type = OperandType::TENSOR_QUANT8_ASYMM, 1558 .dimensions = {0, 0, 0, 0}, 1559 .numberOfConsumers = 0, 1560 .scale = 0.125f, 1561 .zeroPoint = 120, 1562 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1563 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1564 } 1565 }; 1566 1567 const std::vector<Operation> operations = { 1568 { 1569 .type = OperationType::PRELU, 1570 .inputs = {0, 1}, 1571 .outputs = {2}, 1572 } 1573 }; 1574 1575 const std::vector<uint32_t> inputIndexes = {0, 1}; 1576 const std::vector<uint32_t> outputIndexes = {2}; 1577 std::vector<uint8_t> operandValues = {}; 1578 const std::vector<hidl_memory> pools = {}; 1579 1580 return { 1581 .operands = operands, 1582 .operations = operations, 1583 .inputIndexes = inputIndexes, 1584 .outputIndexes = outputIndexes, 1585 .operandValues = operandValues, 1586 .pools = pools, 1587 }; 1588 } 1589 1590 inline bool is_ignored_dynamic_output_shape_weight_as_input_quant8_3(int i) { 1591 static std::set<int> ignore = {}; 1592 return ignore.find(i) != ignore.end(); 1593 } 1594 1595 // Create the model 1596 Model createTestModel_dynamic_output_shape_weight_as_input_quant8_4() { 1597 const std::vector<Operand> operands = { 1598 { 1599 .type = OperandType::TENSOR_QUANT8_ASYMM, 1600 .dimensions = {1, 2, 2, 3}, 1601 .numberOfConsumers = 1, 1602 .scale = 0.25f, 1603 .zeroPoint = 128, 1604 .lifetime = OperandLifeTime::MODEL_INPUT, 1605 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1606 }, 1607 { 1608 .type = OperandType::TENSOR_QUANT8_ASYMM, 1609 .dimensions = {1, 1, 3}, 1610 .numberOfConsumers = 1, 1611 .scale = 0.5f, 1612 .zeroPoint = 50, 1613 .lifetime = OperandLifeTime::MODEL_INPUT, 1614 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1615 }, 1616 { 1617 .type = OperandType::TENSOR_QUANT8_ASYMM, 1618 .dimensions = {0, 0, 0, 0}, 1619 .numberOfConsumers = 0, 1620 .scale = 0.1f, 1621 .zeroPoint = 120, 1622 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1623 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1624 } 1625 }; 1626 1627 const std::vector<Operation> operations = { 1628 { 1629 .type = OperationType::PRELU, 1630 .inputs = {0, 1}, 1631 .outputs = {2}, 1632 } 1633 }; 1634 1635 const std::vector<uint32_t> inputIndexes = {0, 1}; 1636 const std::vector<uint32_t> outputIndexes = {2}; 1637 std::vector<uint8_t> operandValues = {}; 1638 const std::vector<hidl_memory> pools = {}; 1639 1640 return { 1641 .operands = operands, 1642 .operations = operations, 1643 .inputIndexes = inputIndexes, 1644 .outputIndexes = outputIndexes, 1645 .operandValues = operandValues, 1646 .pools = pools, 1647 }; 1648 } 1649 1650 inline bool is_ignored_dynamic_output_shape_weight_as_input_quant8_4(int i) { 1651 static std::set<int> ignore = {}; 1652 return ignore.find(i) != ignore.end(); 1653 } 1654 1655 // Create the model 1656 Model createTestModel_dynamic_output_shape_weight_as_input_float16() { 1657 const std::vector<Operand> operands = { 1658 { 1659 .type = OperandType::TENSOR_FLOAT16, 1660 .dimensions = {1, 2, 2, 3}, 1661 .numberOfConsumers = 1, 1662 .scale = 0.0f, 1663 .zeroPoint = 0, 1664 .lifetime = OperandLifeTime::MODEL_INPUT, 1665 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1666 }, 1667 { 1668 .type = OperandType::TENSOR_FLOAT16, 1669 .dimensions = {1, 1, 3}, 1670 .numberOfConsumers = 1, 1671 .scale = 0.0f, 1672 .zeroPoint = 0, 1673 .lifetime = OperandLifeTime::MODEL_INPUT, 1674 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1675 }, 1676 { 1677 .type = OperandType::TENSOR_FLOAT16, 1678 .dimensions = {0, 0, 0, 0}, 1679 .numberOfConsumers = 0, 1680 .scale = 0.0f, 1681 .zeroPoint = 0, 1682 .lifetime = OperandLifeTime::MODEL_OUTPUT, 1683 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 1684 } 1685 }; 1686 1687 const std::vector<Operation> operations = { 1688 { 1689 .type = OperationType::PRELU, 1690 .inputs = {0, 1}, 1691 .outputs = {2}, 1692 } 1693 }; 1694 1695 const std::vector<uint32_t> inputIndexes = {0, 1}; 1696 const std::vector<uint32_t> outputIndexes = {2}; 1697 std::vector<uint8_t> operandValues = {}; 1698 const std::vector<hidl_memory> pools = {}; 1699 1700 return { 1701 .operands = operands, 1702 .operations = operations, 1703 .inputIndexes = inputIndexes, 1704 .outputIndexes = outputIndexes, 1705 .operandValues = operandValues, 1706 .pools = pools, 1707 }; 1708 } 1709 1710 inline bool is_ignored_dynamic_output_shape_weight_as_input_float16(int i) { 1711 static std::set<int> ignore = {}; 1712 return ignore.find(i) != ignore.end(); 1713 } 1714 1715