• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: add_quant8.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {2}, 2.0f, 0);
5   OperandType type1(Type::TENSOR_QUANT8_ASYMM, {2}, 1.0f, 0);
6   OperandType type2(Type::INT32, {});
7   // Phase 1, operands
8   auto op1 = model->addOperand(&type0);
9   auto op2 = model->addOperand(&type1);
10   auto act = model->addOperand(&type2);
11   auto op3 = model->addOperand(&type1);
12   // Phase 2, operations
13   static int32_t act_init[] = {0};
14   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
15   model->addOperation(ANEURALNETWORKS_ADD, {op1, op2, act}, {op3});
16   // Phase 3, inputs and outputs
17   model->identifyInputsAndOutputs(
18     {op1, op2},
19     {op3});
20   assert(model->isValid());
21 }
22 
is_ignored(int i)23 inline bool is_ignored(int i) {
24   static std::set<int> ignore = {};
25   return ignore.find(i) != ignore.end();
26 }
27 
CreateModel_dynamic_output_shape(Model * model)28 void CreateModel_dynamic_output_shape(Model *model) {
29   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {2}, 2.0f, 0);
30   OperandType type1(Type::TENSOR_QUANT8_ASYMM, {2}, 1.0f, 0);
31   OperandType type2(Type::INT32, {});
32   OperandType type3(Type::TENSOR_QUANT8_ASYMM, {0}, 1.0f, 0);
33   // Phase 1, operands
34   auto op1 = model->addOperand(&type0);
35   auto op2 = model->addOperand(&type1);
36   auto act = model->addOperand(&type2);
37   auto op3 = model->addOperand(&type3);
38   // Phase 2, operations
39   static int32_t act_init[] = {0};
40   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
41   model->addOperation(ANEURALNETWORKS_ADD, {op1, op2, act}, {op3});
42   // Phase 3, inputs and outputs
43   model->identifyInputsAndOutputs(
44     {op1, op2},
45     {op3});
46   assert(model->isValid());
47 }
48 
is_ignored_dynamic_output_shape(int i)49 inline bool is_ignored_dynamic_output_shape(int i) {
50   static std::set<int> ignore = {};
51   return ignore.find(i) != ignore.end();
52 }
53 
54