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