1 // clang-format off
2 // Generated file (from: depthwise_conv_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, {1, 1, 1, 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 b8 = model->addOperand(&type0);
17   auto op3 = model->addOperand(&type1);
18   // Phase 2, operations
19   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
20   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
21   static float op1_init[] = {0.0f, 0.0f, 0.0f};
22   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
23   static int32_t b4_init[] = {1};
24   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
25   static int32_t b5_init[] = {1};
26   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
27   static int32_t b6_init[] = {1};
28   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
29   static int32_t b7_init[] = {1};
30   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
31   static int32_t b8_init[] = {0};
32   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
33   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
34   // Phase 3, inputs and outputs
35   model->identifyInputsAndOutputs(
36     {op2},
37     {op3});
38   // Phase 4: set relaxed execution
39   model->relaxComputationFloat32toFloat16(true);
40   assert(model->isValid());
41 }
42 
is_ignored(int i)43 inline bool is_ignored(int i) {
44   static std::set<int> ignore = {};
45   return ignore.find(i) != ignore.end();
46 }
47 
CreateModel_dynamic_output_shape(Model * model)48 void CreateModel_dynamic_output_shape(Model *model) {
49   OperandType type0(Type::INT32, {});
50   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
51   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
52   OperandType type3(Type::TENSOR_FLOAT32, {3});
53   OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
54   // Phase 1, operands
55   auto op2 = model->addOperand(&type1);
56   auto op0 = model->addOperand(&type2);
57   auto op1 = model->addOperand(&type3);
58   auto b4 = model->addOperand(&type0);
59   auto b5 = model->addOperand(&type0);
60   auto b6 = model->addOperand(&type0);
61   auto b7 = model->addOperand(&type0);
62   auto b8 = model->addOperand(&type0);
63   auto op3 = model->addOperand(&type4);
64   // Phase 2, operations
65   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
66   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
67   static float op1_init[] = {0.0f, 0.0f, 0.0f};
68   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
69   static int32_t b4_init[] = {1};
70   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
71   static int32_t b5_init[] = {1};
72   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
73   static int32_t b6_init[] = {1};
74   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
75   static int32_t b7_init[] = {1};
76   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
77   static int32_t b8_init[] = {0};
78   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
79   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
80   // Phase 3, inputs and outputs
81   model->identifyInputsAndOutputs(
82     {op2},
83     {op3});
84   // Phase 4: set relaxed execution
85   model->relaxComputationFloat32toFloat16(true);
86   assert(model->isValid());
87 }
88 
is_ignored_dynamic_output_shape(int i)89 inline bool is_ignored_dynamic_output_shape(int i) {
90   static std::set<int> ignore = {};
91   return ignore.find(i) != ignore.end();
92 }
93 
CreateModel_2(Model * model)94 void CreateModel_2(Model *model) {
95   OperandType type0(Type::INT32, {});
96   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
97   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
98   OperandType type3(Type::TENSOR_FLOAT32, {3});
99   // Phase 1, operands
100   auto op2 = model->addOperand(&type1);
101   auto op0 = model->addOperand(&type2);
102   auto op1 = model->addOperand(&type3);
103   auto b4 = model->addOperand(&type0);
104   auto b5 = model->addOperand(&type0);
105   auto b6 = model->addOperand(&type0);
106   auto b7 = model->addOperand(&type0);
107   auto b8 = model->addOperand(&type0);
108   auto op3 = model->addOperand(&type1);
109   // Phase 2, operations
110   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
111   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
112   static float op1_init[] = {0.0f, 0.0f, 0.0f};
113   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
114   static int32_t b4_init[] = {1};
115   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
116   static int32_t b5_init[] = {1};
117   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
118   static int32_t b6_init[] = {1};
119   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
120   static int32_t b7_init[] = {1};
121   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
122   static int32_t b8_init[] = {0};
123   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
124   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
125   // Phase 3, inputs and outputs
126   model->identifyInputsAndOutputs(
127     {op2},
128     {op3});
129   // Phase 4: set relaxed execution
130   model->relaxComputationFloat32toFloat16(true);
131   assert(model->isValid());
132 }
133 
is_ignored_2(int i)134 inline bool is_ignored_2(int i) {
135   static std::set<int> ignore = {};
136   return ignore.find(i) != ignore.end();
137 }
138 
CreateModel_dynamic_output_shape_2(Model * model)139 void CreateModel_dynamic_output_shape_2(Model *model) {
140   OperandType type0(Type::INT32, {});
141   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
142   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
143   OperandType type3(Type::TENSOR_FLOAT32, {3});
144   OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
145   // Phase 1, operands
146   auto op2 = model->addOperand(&type1);
147   auto op0 = model->addOperand(&type2);
148   auto op1 = model->addOperand(&type3);
149   auto b4 = model->addOperand(&type0);
150   auto b5 = model->addOperand(&type0);
151   auto b6 = model->addOperand(&type0);
152   auto b7 = model->addOperand(&type0);
153   auto b8 = model->addOperand(&type0);
154   auto op3 = model->addOperand(&type4);
155   // Phase 2, operations
156   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
157   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
158   static float op1_init[] = {0.0f, 0.0f, 0.0f};
159   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
160   static int32_t b4_init[] = {1};
161   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
162   static int32_t b5_init[] = {1};
163   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
164   static int32_t b6_init[] = {1};
165   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
166   static int32_t b7_init[] = {1};
167   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
168   static int32_t b8_init[] = {0};
169   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
170   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
171   // Phase 3, inputs and outputs
172   model->identifyInputsAndOutputs(
173     {op2},
174     {op3});
175   // Phase 4: set relaxed execution
176   model->relaxComputationFloat32toFloat16(true);
177   assert(model->isValid());
178 }
179 
is_ignored_dynamic_output_shape_2(int i)180 inline bool is_ignored_dynamic_output_shape_2(int i) {
181   static std::set<int> ignore = {};
182   return ignore.find(i) != ignore.end();
183 }
184 
185