• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: split_float_1.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {6});
5   OperandType type1(Type::INT32, {});
6   OperandType type2(Type::TENSOR_FLOAT32, {2});
7   // Phase 1, operands
8   auto input0 = model->addOperand(&type0);
9   auto axis = model->addOperand(&type1);
10   auto num_splits = model->addOperand(&type1);
11   auto output0 = model->addOperand(&type2);
12   auto output1 = model->addOperand(&type2);
13   auto output2 = model->addOperand(&type2);
14   // Phase 2, operations
15   static int32_t axis_init[] = {0};
16   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
17   static int32_t num_splits_init[] = {3};
18   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
19   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1, output2});
20   // Phase 3, inputs and outputs
21   model->identifyInputsAndOutputs(
22     {input0},
23     {output0, output1, output2});
24   assert(model->isValid());
25 }
26 
is_ignored(int i)27 inline bool is_ignored(int i) {
28   static std::set<int> ignore = {};
29   return ignore.find(i) != ignore.end();
30 }
31 
CreateModel_relaxed(Model * model)32 void CreateModel_relaxed(Model *model) {
33   OperandType type0(Type::TENSOR_FLOAT32, {6});
34   OperandType type1(Type::INT32, {});
35   OperandType type2(Type::TENSOR_FLOAT32, {2});
36   // Phase 1, operands
37   auto input0 = model->addOperand(&type0);
38   auto axis = model->addOperand(&type1);
39   auto num_splits = model->addOperand(&type1);
40   auto output0 = model->addOperand(&type2);
41   auto output1 = model->addOperand(&type2);
42   auto output2 = model->addOperand(&type2);
43   // Phase 2, operations
44   static int32_t axis_init[] = {0};
45   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
46   static int32_t num_splits_init[] = {3};
47   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
48   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1, output2});
49   // Phase 3, inputs and outputs
50   model->identifyInputsAndOutputs(
51     {input0},
52     {output0, output1, output2});
53   // Phase 4: set relaxed execution
54   model->relaxComputationFloat32toFloat16(true);
55   assert(model->isValid());
56 }
57 
is_ignored_relaxed(int i)58 inline bool is_ignored_relaxed(int i) {
59   static std::set<int> ignore = {};
60   return ignore.find(i) != ignore.end();
61 }
62 
CreateModel_float16(Model * model)63 void CreateModel_float16(Model *model) {
64   OperandType type1(Type::INT32, {});
65   OperandType type3(Type::TENSOR_FLOAT16, {6});
66   OperandType type4(Type::TENSOR_FLOAT16, {2});
67   // Phase 1, operands
68   auto input0 = model->addOperand(&type3);
69   auto axis = model->addOperand(&type1);
70   auto num_splits = model->addOperand(&type1);
71   auto output0 = model->addOperand(&type4);
72   auto output1 = model->addOperand(&type4);
73   auto output2 = model->addOperand(&type4);
74   // Phase 2, operations
75   static int32_t axis_init[] = {0};
76   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
77   static int32_t num_splits_init[] = {3};
78   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
79   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1, output2});
80   // Phase 3, inputs and outputs
81   model->identifyInputsAndOutputs(
82     {input0},
83     {output0, output1, output2});
84   assert(model->isValid());
85 }
86 
is_ignored_float16(int i)87 inline bool is_ignored_float16(int i) {
88   static std::set<int> ignore = {};
89   return ignore.find(i) != ignore.end();
90 }
91 
CreateModel_dynamic_output_shape(Model * model)92 void CreateModel_dynamic_output_shape(Model *model) {
93   OperandType type0(Type::TENSOR_FLOAT32, {6});
94   OperandType type1(Type::INT32, {});
95   OperandType type5(Type::TENSOR_FLOAT32, {0});
96   // Phase 1, operands
97   auto input0 = model->addOperand(&type0);
98   auto axis = model->addOperand(&type1);
99   auto num_splits = model->addOperand(&type1);
100   auto output0 = model->addOperand(&type5);
101   auto output1 = model->addOperand(&type5);
102   auto output2 = model->addOperand(&type5);
103   // Phase 2, operations
104   static int32_t axis_init[] = {0};
105   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
106   static int32_t num_splits_init[] = {3};
107   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
108   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1, output2});
109   // Phase 3, inputs and outputs
110   model->identifyInputsAndOutputs(
111     {input0},
112     {output0, output1, output2});
113   assert(model->isValid());
114 }
115 
is_ignored_dynamic_output_shape(int i)116 inline bool is_ignored_dynamic_output_shape(int i) {
117   static std::set<int> ignore = {};
118   return ignore.find(i) != ignore.end();
119 }
120 
CreateModel_dynamic_output_shape_relaxed(Model * model)121 void CreateModel_dynamic_output_shape_relaxed(Model *model) {
122   OperandType type0(Type::TENSOR_FLOAT32, {6});
123   OperandType type1(Type::INT32, {});
124   OperandType type5(Type::TENSOR_FLOAT32, {0});
125   // Phase 1, operands
126   auto input0 = model->addOperand(&type0);
127   auto axis = model->addOperand(&type1);
128   auto num_splits = model->addOperand(&type1);
129   auto output0 = model->addOperand(&type5);
130   auto output1 = model->addOperand(&type5);
131   auto output2 = model->addOperand(&type5);
132   // Phase 2, operations
133   static int32_t axis_init[] = {0};
134   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
135   static int32_t num_splits_init[] = {3};
136   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
137   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1, output2});
138   // Phase 3, inputs and outputs
139   model->identifyInputsAndOutputs(
140     {input0},
141     {output0, output1, output2});
142   // Phase 4: set relaxed execution
143   model->relaxComputationFloat32toFloat16(true);
144   assert(model->isValid());
145 }
146 
is_ignored_dynamic_output_shape_relaxed(int i)147 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
148   static std::set<int> ignore = {};
149   return ignore.find(i) != ignore.end();
150 }
151 
CreateModel_dynamic_output_shape_float16(Model * model)152 void CreateModel_dynamic_output_shape_float16(Model *model) {
153   OperandType type1(Type::INT32, {});
154   OperandType type3(Type::TENSOR_FLOAT16, {6});
155   OperandType type6(Type::TENSOR_FLOAT16, {0});
156   // Phase 1, operands
157   auto input0 = model->addOperand(&type3);
158   auto axis = model->addOperand(&type1);
159   auto num_splits = model->addOperand(&type1);
160   auto output0 = model->addOperand(&type6);
161   auto output1 = model->addOperand(&type6);
162   auto output2 = model->addOperand(&type6);
163   // Phase 2, operations
164   static int32_t axis_init[] = {0};
165   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
166   static int32_t num_splits_init[] = {3};
167   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
168   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1, output2});
169   // Phase 3, inputs and outputs
170   model->identifyInputsAndOutputs(
171     {input0},
172     {output0, output1, output2});
173   assert(model->isValid());
174 }
175 
is_ignored_dynamic_output_shape_float16(int i)176 inline bool is_ignored_dynamic_output_shape_float16(int i) {
177   static std::set<int> ignore = {};
178   return ignore.find(i) != ignore.end();
179 }
180 
181