1 // clang-format off
2 // Generated file (from: conv_quant8_weights_as_inputs.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
5   OperandType type1(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0);
6   OperandType type2(Type::TENSOR_INT32, {1}, 0.25f, 0);
7   OperandType type3(Type::INT32, {});
8   OperandType type4(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 1.0f, 0);
9   // Phase 1, operands
10   auto op1 = model->addOperand(&type0);
11   auto op2 = model->addOperand(&type1);
12   auto op3 = model->addOperand(&type2);
13   auto pad0 = model->addOperand(&type3);
14   auto stride = model->addOperand(&type3);
15   auto act = model->addOperand(&type3);
16   auto op4 = model->addOperand(&type4);
17   // Phase 2, operations
18   static int32_t pad0_init[] = {0};
19   model->setOperandValue(pad0, pad0_init, sizeof(int32_t) * 1);
20   static int32_t stride_init[] = {1};
21   model->setOperandValue(stride, stride_init, sizeof(int32_t) * 1);
22   static int32_t act_init[] = {0};
23   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
24   model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, pad0, pad0, pad0, pad0, stride, stride, act}, {op4});
25   // Phase 3, inputs and outputs
26   model->identifyInputsAndOutputs(
27     {op1, op2, op3},
28     {op4});
29   assert(model->isValid());
30 }
31 
is_ignored(int i)32 inline bool is_ignored(int i) {
33   static std::set<int> ignore = {};
34   return ignore.find(i) != ignore.end();
35 }
36 
CreateModel_dynamic_output_shape(Model * model)37 void CreateModel_dynamic_output_shape(Model *model) {
38   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
39   OperandType type1(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0);
40   OperandType type2(Type::TENSOR_INT32, {1}, 0.25f, 0);
41   OperandType type3(Type::INT32, {});
42   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 0);
43   // Phase 1, operands
44   auto op1 = model->addOperand(&type0);
45   auto op2 = model->addOperand(&type1);
46   auto op3 = model->addOperand(&type2);
47   auto pad0 = model->addOperand(&type3);
48   auto stride = model->addOperand(&type3);
49   auto act = model->addOperand(&type3);
50   auto op4 = model->addOperand(&type5);
51   // Phase 2, operations
52   static int32_t pad0_init[] = {0};
53   model->setOperandValue(pad0, pad0_init, sizeof(int32_t) * 1);
54   static int32_t stride_init[] = {1};
55   model->setOperandValue(stride, stride_init, sizeof(int32_t) * 1);
56   static int32_t act_init[] = {0};
57   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
58   model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, pad0, pad0, pad0, pad0, stride, stride, act}, {op4});
59   // Phase 3, inputs and outputs
60   model->identifyInputsAndOutputs(
61     {op1, op2, op3},
62     {op4});
63   assert(model->isValid());
64 }
65 
is_ignored_dynamic_output_shape(int i)66 inline bool is_ignored_dynamic_output_shape(int i) {
67   static std::set<int> ignore = {};
68   return ignore.find(i) != ignore.end();
69 }
70 
71