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