• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: reduce_any.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_BOOL8, {1});
5   OperandType type1(Type::TENSOR_INT32, {1});
6   OperandType type2(Type::BOOL, {});
7   // Phase 1, operands
8   auto input0 = model->addOperand(&type0);
9   auto param = model->addOperand(&type1);
10   auto param1 = model->addOperand(&type2);
11   auto output0 = model->addOperand(&type0);
12   // Phase 2, operations
13   static int32_t param_init[] = {0};
14   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
15   static bool8 param1_init[] = {true};
16   model->setOperandValue(param1, param1_init, sizeof(bool8) * 1);
17   model->addOperation(ANEURALNETWORKS_REDUCE_ANY, {input0, param, param1}, {output0});
18   // Phase 3, inputs and outputs
19   model->identifyInputsAndOutputs(
20     {input0},
21     {output0});
22   assert(model->isValid());
23 }
24 
is_ignored(int i)25 inline bool is_ignored(int i) {
26   static std::set<int> ignore = {};
27   return ignore.find(i) != ignore.end();
28 }
29 
CreateModel_dynamic_output_shape(Model * model)30 void CreateModel_dynamic_output_shape(Model *model) {
31   OperandType type0(Type::TENSOR_BOOL8, {1});
32   OperandType type1(Type::TENSOR_INT32, {1});
33   OperandType type2(Type::BOOL, {});
34   OperandType type8(Type::TENSOR_BOOL8, {0});
35   // Phase 1, operands
36   auto input0 = model->addOperand(&type0);
37   auto param = model->addOperand(&type1);
38   auto param1 = model->addOperand(&type2);
39   auto output0 = model->addOperand(&type8);
40   // Phase 2, operations
41   static int32_t param_init[] = {0};
42   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
43   static bool8 param1_init[] = {true};
44   model->setOperandValue(param1, param1_init, sizeof(bool8) * 1);
45   model->addOperation(ANEURALNETWORKS_REDUCE_ANY, {input0, param, param1}, {output0});
46   // Phase 3, inputs and outputs
47   model->identifyInputsAndOutputs(
48     {input0},
49     {output0});
50   assert(model->isValid());
51 }
52 
is_ignored_dynamic_output_shape(int i)53 inline bool is_ignored_dynamic_output_shape(int i) {
54   static std::set<int> ignore = {};
55   return ignore.find(i) != ignore.end();
56 }
57 
CreateModel_2(Model * model)58 void CreateModel_2(Model *model) {
59   OperandType type2(Type::BOOL, {});
60   OperandType type3(Type::TENSOR_BOOL8, {2, 3, 2});
61   OperandType type4(Type::TENSOR_BOOL8, {2});
62   OperandType type5(Type::TENSOR_INT32, {4});
63   // Phase 1, operands
64   auto input01 = model->addOperand(&type3);
65   auto param2 = model->addOperand(&type5);
66   auto param3 = model->addOperand(&type2);
67   auto output01 = model->addOperand(&type4);
68   // Phase 2, operations
69   static int32_t param2_init[] = {1, 0, -3, -3};
70   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 4);
71   static bool8 param3_init[] = {false};
72   model->setOperandValue(param3, param3_init, sizeof(bool8) * 1);
73   model->addOperation(ANEURALNETWORKS_REDUCE_ANY, {input01, param2, param3}, {output01});
74   // Phase 3, inputs and outputs
75   model->identifyInputsAndOutputs(
76     {input01},
77     {output01});
78   assert(model->isValid());
79 }
80 
is_ignored_2(int i)81 inline bool is_ignored_2(int i) {
82   static std::set<int> ignore = {};
83   return ignore.find(i) != ignore.end();
84 }
85 
CreateModel_dynamic_output_shape_2(Model * model)86 void CreateModel_dynamic_output_shape_2(Model *model) {
87   OperandType type2(Type::BOOL, {});
88   OperandType type3(Type::TENSOR_BOOL8, {2, 3, 2});
89   OperandType type5(Type::TENSOR_INT32, {4});
90   OperandType type8(Type::TENSOR_BOOL8, {0});
91   // Phase 1, operands
92   auto input01 = model->addOperand(&type3);
93   auto param2 = model->addOperand(&type5);
94   auto param3 = model->addOperand(&type2);
95   auto output01 = model->addOperand(&type8);
96   // Phase 2, operations
97   static int32_t param2_init[] = {1, 0, -3, -3};
98   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 4);
99   static bool8 param3_init[] = {false};
100   model->setOperandValue(param3, param3_init, sizeof(bool8) * 1);
101   model->addOperation(ANEURALNETWORKS_REDUCE_ANY, {input01, param2, param3}, {output01});
102   // Phase 3, inputs and outputs
103   model->identifyInputsAndOutputs(
104     {input01},
105     {output01});
106   assert(model->isValid());
107 }
108 
is_ignored_dynamic_output_shape_2(int i)109 inline bool is_ignored_dynamic_output_shape_2(int i) {
110   static std::set<int> ignore = {};
111   return ignore.find(i) != ignore.end();
112 }
113 
CreateModel_3(Model * model)114 void CreateModel_3(Model *model) {
115   OperandType type2(Type::BOOL, {});
116   OperandType type3(Type::TENSOR_BOOL8, {2, 3, 2});
117   OperandType type6(Type::TENSOR_BOOL8, {1, 3, 1});
118   OperandType type7(Type::TENSOR_INT32, {2});
119   // Phase 1, operands
120   auto input02 = model->addOperand(&type3);
121   auto param4 = model->addOperand(&type7);
122   auto param5 = model->addOperand(&type2);
123   auto output02 = model->addOperand(&type6);
124   // Phase 2, operations
125   static int32_t param4_init[] = {0, 2};
126   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 2);
127   static bool8 param5_init[] = {true};
128   model->setOperandValue(param5, param5_init, sizeof(bool8) * 1);
129   model->addOperation(ANEURALNETWORKS_REDUCE_ANY, {input02, param4, param5}, {output02});
130   // Phase 3, inputs and outputs
131   model->identifyInputsAndOutputs(
132     {input02},
133     {output02});
134   assert(model->isValid());
135 }
136 
is_ignored_3(int i)137 inline bool is_ignored_3(int i) {
138   static std::set<int> ignore = {};
139   return ignore.find(i) != ignore.end();
140 }
141 
CreateModel_dynamic_output_shape_3(Model * model)142 void CreateModel_dynamic_output_shape_3(Model *model) {
143   OperandType type2(Type::BOOL, {});
144   OperandType type3(Type::TENSOR_BOOL8, {2, 3, 2});
145   OperandType type7(Type::TENSOR_INT32, {2});
146   OperandType type9(Type::TENSOR_BOOL8, {0, 0, 0});
147   // Phase 1, operands
148   auto input02 = model->addOperand(&type3);
149   auto param4 = model->addOperand(&type7);
150   auto param5 = model->addOperand(&type2);
151   auto output02 = model->addOperand(&type9);
152   // Phase 2, operations
153   static int32_t param4_init[] = {0, 2};
154   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 2);
155   static bool8 param5_init[] = {true};
156   model->setOperandValue(param5, param5_init, sizeof(bool8) * 1);
157   model->addOperation(ANEURALNETWORKS_REDUCE_ANY, {input02, param4, param5}, {output02});
158   // Phase 3, inputs and outputs
159   model->identifyInputsAndOutputs(
160     {input02},
161     {output02});
162   assert(model->isValid());
163 }
164 
is_ignored_dynamic_output_shape_3(int i)165 inline bool is_ignored_dynamic_output_shape_3(int i) {
166   static std::set<int> ignore = {};
167   return ignore.find(i) != ignore.end();
168 }
169 
170