1 // clang-format off
2 // Generated file (from: conv_3_h3_w2_SAME_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::INT32, {});
5   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
6   OperandType type2(Type::TENSOR_FLOAT32, {3, 3, 2, 3});
7   OperandType type3(Type::TENSOR_FLOAT32, {3});
8   // Phase 1, operands
9   auto op2 = model->addOperand(&type1);
10   auto op0 = model->addOperand(&type2);
11   auto op1 = model->addOperand(&type3);
12   auto b4 = model->addOperand(&type0);
13   auto b5 = model->addOperand(&type0);
14   auto b6 = model->addOperand(&type0);
15   auto b7 = model->addOperand(&type0);
16   auto op3 = model->addOperand(&type1);
17   // Phase 2, operations
18   static float op0_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f};
19   model->setOperandValue(op0, op0_init, sizeof(float) * 54);
20   static float op1_init[] = {0.0f, 0.0f, 0.0f};
21   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
22   static int32_t b4_init[] = {1};
23   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
24   static int32_t b5_init[] = {1};
25   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
26   static int32_t b6_init[] = {1};
27   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
28   static int32_t b7_init[] = {0};
29   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
30   model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
31   // Phase 3, inputs and outputs
32   model->identifyInputsAndOutputs(
33     {op2},
34     {op3});
35   // Phase 4: set relaxed execution
36   model->relaxComputationFloat32toFloat16(true);
37   assert(model->isValid());
38 }
39 
is_ignored(int i)40 inline bool is_ignored(int i) {
41   static std::set<int> ignore = {};
42   return ignore.find(i) != ignore.end();
43 }
44 
CreateModel_dynamic_output_shape(Model * model)45 void CreateModel_dynamic_output_shape(Model *model) {
46   OperandType type0(Type::INT32, {});
47   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
48   OperandType type2(Type::TENSOR_FLOAT32, {3, 3, 2, 3});
49   OperandType type3(Type::TENSOR_FLOAT32, {3});
50   OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
51   // Phase 1, operands
52   auto op2 = model->addOperand(&type1);
53   auto op0 = model->addOperand(&type2);
54   auto op1 = model->addOperand(&type3);
55   auto b4 = model->addOperand(&type0);
56   auto b5 = model->addOperand(&type0);
57   auto b6 = model->addOperand(&type0);
58   auto b7 = model->addOperand(&type0);
59   auto op3 = model->addOperand(&type4);
60   // Phase 2, operations
61   static float op0_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f};
62   model->setOperandValue(op0, op0_init, sizeof(float) * 54);
63   static float op1_init[] = {0.0f, 0.0f, 0.0f};
64   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
65   static int32_t b4_init[] = {1};
66   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
67   static int32_t b5_init[] = {1};
68   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
69   static int32_t b6_init[] = {1};
70   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
71   static int32_t b7_init[] = {0};
72   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
73   model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
74   // Phase 3, inputs and outputs
75   model->identifyInputsAndOutputs(
76     {op2},
77     {op3});
78   // Phase 4: set relaxed execution
79   model->relaxComputationFloat32toFloat16(true);
80   assert(model->isValid());
81 }
82 
is_ignored_dynamic_output_shape(int i)83 inline bool is_ignored_dynamic_output_shape(int i) {
84   static std::set<int> ignore = {};
85   return ignore.find(i) != ignore.end();
86 }
87 
CreateModel_2(Model * model)88 void CreateModel_2(Model *model) {
89   OperandType type0(Type::INT32, {});
90   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
91   OperandType type2(Type::TENSOR_FLOAT32, {3, 3, 2, 3});
92   OperandType type3(Type::TENSOR_FLOAT32, {3});
93   // Phase 1, operands
94   auto op2 = model->addOperand(&type1);
95   auto op0 = model->addOperand(&type2);
96   auto op1 = model->addOperand(&type3);
97   auto b4 = model->addOperand(&type0);
98   auto b5 = model->addOperand(&type0);
99   auto b6 = model->addOperand(&type0);
100   auto b7 = model->addOperand(&type0);
101   auto op3 = model->addOperand(&type1);
102   // Phase 2, operations
103   static float op0_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f};
104   model->setOperandValue(op0, op0_init, sizeof(float) * 54);
105   static float op1_init[] = {0.0f, 0.0f, 0.0f};
106   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
107   static int32_t b4_init[] = {1};
108   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
109   static int32_t b5_init[] = {1};
110   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
111   static int32_t b6_init[] = {1};
112   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
113   static int32_t b7_init[] = {0};
114   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
115   model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
116   // Phase 3, inputs and outputs
117   model->identifyInputsAndOutputs(
118     {op2},
119     {op3});
120   // Phase 4: set relaxed execution
121   model->relaxComputationFloat32toFloat16(true);
122   assert(model->isValid());
123 }
124 
is_ignored_2(int i)125 inline bool is_ignored_2(int i) {
126   static std::set<int> ignore = {};
127   return ignore.find(i) != ignore.end();
128 }
129 
CreateModel_dynamic_output_shape_2(Model * model)130 void CreateModel_dynamic_output_shape_2(Model *model) {
131   OperandType type0(Type::INT32, {});
132   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
133   OperandType type2(Type::TENSOR_FLOAT32, {3, 3, 2, 3});
134   OperandType type3(Type::TENSOR_FLOAT32, {3});
135   OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
136   // Phase 1, operands
137   auto op2 = model->addOperand(&type1);
138   auto op0 = model->addOperand(&type2);
139   auto op1 = model->addOperand(&type3);
140   auto b4 = model->addOperand(&type0);
141   auto b5 = model->addOperand(&type0);
142   auto b6 = model->addOperand(&type0);
143   auto b7 = model->addOperand(&type0);
144   auto op3 = model->addOperand(&type4);
145   // Phase 2, operations
146   static float op0_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f};
147   model->setOperandValue(op0, op0_init, sizeof(float) * 54);
148   static float op1_init[] = {0.0f, 0.0f, 0.0f};
149   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
150   static int32_t b4_init[] = {1};
151   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
152   static int32_t b5_init[] = {1};
153   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
154   static int32_t b6_init[] = {1};
155   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
156   static int32_t b7_init[] = {0};
157   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
158   model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
159   // Phase 3, inputs and outputs
160   model->identifyInputsAndOutputs(
161     {op2},
162     {op3});
163   // Phase 4: set relaxed execution
164   model->relaxComputationFloat32toFloat16(true);
165   assert(model->isValid());
166 }
167 
is_ignored_dynamic_output_shape_2(int i)168 inline bool is_ignored_dynamic_output_shape_2(int i) {
169   static std::set<int> ignore = {};
170   return ignore.find(i) != ignore.end();
171 }
172 
173