blob: 1d20066f4434f1083eb00c1e5a1fa6a5b92241d8 [file] [log] [blame]
Eric Kunzee5e26762020-10-13 16:11:07 -07001
Tai Lya4d748b2023-03-28 22:06:56 +00002// Copyright (c) 2020-2023, ARM Limited.
Eric Kunzee5e26762020-10-13 16:11:07 -07003//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef OPS_OP_FACTORY_H
17#define OPS_OP_FACTORY_H
18
19#include "attribute.h"
20#include "graph_node.h"
Eric Kunzee5e26762020-10-13 16:11:07 -070021#include "template_types.h"
22#include "tosa_serialization_handler.h"
23
24#define DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, RANK, DTYPE) \
25 case RANK: \
Tai Lya4d748b2023-03-28 22:06:56 +000026 return new OP<RANK, TOSA_REF_TYPE_##DTYPE>(sgt, attribute, id);
Eric Kunzee5e26762020-10-13 16:11:07 -070027
28#define DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, RANK, DTYPE1, DTYPE2) \
29 case RANK: \
Tai Lya4d748b2023-03-28 22:06:56 +000030 return new OP<RANK, TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2>(sgt, attribute, id);
Eric Kunzee5e26762020-10-13 16:11:07 -070031
32#define DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, RANK1, RANK2, DTYPE) \
33 case RANK2: \
Tai Lya4d748b2023-03-28 22:06:56 +000034 return new OP<RANK1, RANK2, TOSA_REF_TYPE_##DTYPE>(sgt, attribute, id);
Eric Kunzee5e26762020-10-13 16:11:07 -070035
36#define DEF_FACTORY_TWO_RANK_TWO_TYPE(OP, RANK1, RANK2, DTYPE1, DTYPE2) \
37 case RANK2: \
Tai Lya4d748b2023-03-28 22:06:56 +000038 return new OP<RANK1, RANK2, TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2>(sgt, attribute, id);
Eric Kunzee5e26762020-10-13 16:11:07 -070039
40#define DEF_FACTORY_ONE_RANK_0_6(OP) \
41 switch (inputRank) \
42 { \
43 case 0: \
TatWai Chongf7326092022-06-08 12:17:14 -070044 return new OP<0>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070045 case 1: \
TatWai Chongf7326092022-06-08 12:17:14 -070046 return new OP<1>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070047 case 2: \
TatWai Chongf7326092022-06-08 12:17:14 -070048 return new OP<2>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070049 case 3: \
TatWai Chongf7326092022-06-08 12:17:14 -070050 return new OP<3>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070051 case 4: \
TatWai Chongf7326092022-06-08 12:17:14 -070052 return new OP<4>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070053 case 5: \
TatWai Chongf7326092022-06-08 12:17:14 -070054 return new OP<5>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070055 case 6: \
TatWai Chongf7326092022-06-08 12:17:14 -070056 return new OP<6>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070057 }
58
59#define DEF_FACTORY_ONE_TYPE(OP, DTYPE) \
Tai Lya4d748b2023-03-28 22:06:56 +000060 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE) \
Eric Kunzee5e26762020-10-13 16:11:07 -070061 { \
Tai Lya4d748b2023-03-28 22:06:56 +000062 return new OP<TOSA_REF_TYPE_##DTYPE>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070063 }
64
Tai Ly8ead6c42024-02-14 22:35:44 +000065#define DEF_FACTORY_ONE_TYPE_ONE_ACCUM(OP, ATTR_NAME, DTYPE, ACC_TYPE) \
66 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE && ACCUM_FROM_ATTRIBUTE(ATTR_NAME) == TOSA_REF_TYPE_##ACC_TYPE) \
James Ward8b390432022-08-12 20:48:56 +010067 { \
Tai Ly8ead6c42024-02-14 22:35:44 +000068 return new OP<TOSA_REF_TYPE_##DTYPE, TOSA_REF_TYPE_##ACC_TYPE>(sgt, attribute, id); \
James Ward8b390432022-08-12 20:48:56 +010069 }
70
Eric Kunzee5e26762020-10-13 16:11:07 -070071#define DEF_FACTORY_TWO_TYPE(OP, DTYPE1, DTYPE2) \
Tai Lya4d748b2023-03-28 22:06:56 +000072 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && weightDTYPE == TOSA_REF_TYPE_##DTYPE2) \
Eric Kunzee5e26762020-10-13 16:11:07 -070073 { \
Tai Lya4d748b2023-03-28 22:06:56 +000074 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -070075 }
76
James Wardd34b3fc2023-01-18 14:51:25 +000077#define DEF_FACTORY_TWO_TYPE_IN_OUT(OP, DTYPE1, DTYPE2) \
Tai Lya4d748b2023-03-28 22:06:56 +000078 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
James Wardd34b3fc2023-01-18 14:51:25 +000079 { \
Tai Lya4d748b2023-03-28 22:06:56 +000080 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2>(sgt, attribute, id); \
James Wardd34b3fc2023-01-18 14:51:25 +000081 }
82
Tai Ly8ead6c42024-02-14 22:35:44 +000083#define DEF_FACTORY_TWO_TYPE_ONE_ACCUM(OP, ATTR_NAME, DTYPE1, DTYPE2, ACC_TYPE) \
Tai Lya4d748b2023-03-28 22:06:56 +000084 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && weightDTYPE == TOSA_REF_TYPE_##DTYPE2 && \
Tai Ly8ead6c42024-02-14 22:35:44 +000085 ACCUM_FROM_ATTRIBUTE(ATTR_NAME) == TOSA_REF_TYPE_##ACC_TYPE) \
James Ward8b390432022-08-12 20:48:56 +010086 { \
Tai Ly8ead6c42024-02-14 22:35:44 +000087 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, TOSA_REF_TYPE_##ACC_TYPE>(sgt, attribute, id); \
Tai Lya4d748b2023-03-28 22:06:56 +000088 }
James Ward8b390432022-08-12 20:48:56 +010089
James Wardd34b3fc2023-01-18 14:51:25 +000090#define DEF_FACTORY_THREE_TYPE(OP, DTYPE1, DTYPE2, DTYPE3) \
Tai Lya4d748b2023-03-28 22:06:56 +000091 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && weightDTYPE == TOSA_REF_TYPE_##DTYPE2 && \
92 outputDTYPE == TOSA_REF_TYPE_##DTYPE3) \
James Wardd34b3fc2023-01-18 14:51:25 +000093 { \
Tai Lya4d748b2023-03-28 22:06:56 +000094 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, TOSA_REF_TYPE_##DTYPE3>(sgt, attribute, id); \
James Wardd34b3fc2023-01-18 14:51:25 +000095 }
96
James Ward8b390432022-08-12 20:48:56 +010097// Statement-expression to evaluate accumulate attribute in-place
98#define ACCUM_FROM_ATTRIBUTE(ATTRIBUTE_NAME) \
99 ({ \
100 tosa::DType accumDType = tosa::DType_UNKNOWN; \
101 if (auto p = dynamic_cast<tosa::Tosa##ATTRIBUTE_NAME##Attribute*>(attribute)) \
102 { \
103 auto attr = new tosa::Tosa##ATTRIBUTE_NAME##Attribute(p); \
104 ASSERT_MEM(attr); \
Tai Ly8ead6c42024-02-14 22:35:44 +0000105 accumDType = tosa::EnumValuesDType()[attr->acc_type()]; \
James Ward8b390432022-08-12 20:48:56 +0100106 } \
107 else \
108 { \
109 FATAL_ERROR("Can't initialize Tosa" #ATTRIBUTE_NAME "Attribute.\nPre-initialization " \
110 "of this attribute is required in order to determine the accumulate type."); \
111 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000112 ConvertDType(accumDType); \
Tai Lya4d748b2023-03-28 22:06:56 +0000113 })
James Ward8b390432022-08-12 20:48:56 +0100114
TatWai Chongf7326092022-06-08 12:17:14 -0700115#define DEF_FACTORY_TWO_TYPE_RESIZE_INT16(OP, DTYPE1, DTYPE2) \
Tai Lya4d748b2023-03-28 22:06:56 +0000116 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
Eric Kunzee5e26762020-10-13 16:11:07 -0700117 { \
Tai Lya4d748b2023-03-28 22:06:56 +0000118 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, int16_t>(sgt, attribute, id); \
TatWai Chongf7326092022-06-08 12:17:14 -0700119 }
120
James Ward8b390432022-08-12 20:48:56 +0100121#define DEF_FACTORY_TWO_TYPE_RESIZE_FP16(OP, DTYPE1, DTYPE2) \
Tai Lya4d748b2023-03-28 22:06:56 +0000122 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
James Ward8b390432022-08-12 20:48:56 +0100123 { \
Tai Lya4d748b2023-03-28 22:06:56 +0000124 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, half_float::half>(sgt, attribute, id); \
James Ward8b390432022-08-12 20:48:56 +0100125 }
126
James Ward24dbc422022-10-19 12:20:31 +0100127#define DEF_FACTORY_TWO_TYPE_RESIZE_BF16(OP, DTYPE1, DTYPE2) \
Tai Lya4d748b2023-03-28 22:06:56 +0000128 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
James Ward24dbc422022-10-19 12:20:31 +0100129 { \
Tai Lya4d748b2023-03-28 22:06:56 +0000130 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, Eigen::bfloat16>(sgt, attribute, id); \
James Ward24dbc422022-10-19 12:20:31 +0100131 }
132
Tai Lya4d748b2023-03-28 22:06:56 +0000133#define DEF_FACTORY_TWO_TYPE_RESIZE_FP32(OP, DTYPE1, DTYPE2) \
134 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
TatWai Chongf7326092022-06-08 12:17:14 -0700135 { \
Tai Lya4d748b2023-03-28 22:06:56 +0000136 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, float>(sgt, attribute, id); \
137 }
138
139#define DEF_FACTORY_TWO_TYPE_RESIZE_FP64(OP, DTYPE1, DTYPE2) \
140 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
141 { \
142 return new OP<TOSA_REF_TYPE_##DTYPE1, TOSA_REF_TYPE_##DTYPE2, double>(sgt, attribute, id); \
Eric Kunzee5e26762020-10-13 16:11:07 -0700143 }
144
145#define DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OP, DTYPE) \
Tai Lya4d748b2023-03-28 22:06:56 +0000146 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE) \
Eric Kunzee5e26762020-10-13 16:11:07 -0700147 { \
148 switch (inputRank) \
149 { \
150 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 0, DTYPE) \
151 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 1, DTYPE) \
152 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 2, DTYPE) \
153 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 3, DTYPE) \
154 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 4, DTYPE) \
155 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 5, DTYPE) \
156 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 6, DTYPE) \
157 } \
158 }
159
160#define DEF_FACTORY_RANK1_6_ONE_RANK_ONE_TYPE(OP, DTYPE) \
Tai Lya4d748b2023-03-28 22:06:56 +0000161 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE) \
Eric Kunzee5e26762020-10-13 16:11:07 -0700162 { \
163 switch (inputRank) \
164 { \
165 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 1, DTYPE) \
166 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 2, DTYPE) \
167 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 3, DTYPE) \
168 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 4, DTYPE) \
169 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 5, DTYPE) \
170 DEF_FACTORY_ONE_RANK_ONE_TYPE(OP, 6, DTYPE) \
171 } \
172 }
173
174#define DEF_FACTORY_RANK0_6_ONE_RANK_TWO_TYPE(OP, DTYPE1, DTYPE2) \
Tai Lya4d748b2023-03-28 22:06:56 +0000175 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE1 && outputDTYPE == TOSA_REF_TYPE_##DTYPE2) \
Eric Kunzee5e26762020-10-13 16:11:07 -0700176 { \
177 switch (inputRank) \
178 { \
179 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 0, DTYPE1, DTYPE2) \
180 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 1, DTYPE1, DTYPE2) \
181 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 2, DTYPE1, DTYPE2) \
182 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 3, DTYPE1, DTYPE2) \
183 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 4, DTYPE1, DTYPE2) \
184 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 5, DTYPE1, DTYPE2) \
185 DEF_FACTORY_ONE_RANK_TWO_TYPE(OP, 6, DTYPE1, DTYPE2) \
186 } \
187 }
188
189#define DEF_FACTORY_RESHAPE(OP, DTYPE) \
Tai Lya4d748b2023-03-28 22:06:56 +0000190 if (inputDTYPE == TOSA_REF_TYPE_##DTYPE && outputDTYPE == TOSA_REF_TYPE_##DTYPE) \
Eric Kunzee5e26762020-10-13 16:11:07 -0700191 { \
192 switch (inputRank) \
193 { \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000194 case 0: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700195 switch (outputRank) \
196 { \
197 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 0, DTYPE) \
198 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 1, DTYPE) \
199 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 2, DTYPE) \
200 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 3, DTYPE) \
201 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 4, DTYPE) \
202 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 5, DTYPE) \
203 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 0, 6, DTYPE) \
204 } \
205 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000206 case 1: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700207 switch (outputRank) \
208 { \
209 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 0, DTYPE) \
210 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 1, DTYPE) \
211 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 2, DTYPE) \
212 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 3, DTYPE) \
213 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 4, DTYPE) \
214 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 5, DTYPE) \
215 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 1, 6, DTYPE) \
216 } \
217 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000218 case 2: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700219 switch (outputRank) \
220 { \
221 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 0, DTYPE) \
222 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 1, DTYPE) \
223 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 2, DTYPE) \
224 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 3, DTYPE) \
225 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 4, DTYPE) \
226 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 5, DTYPE) \
227 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 2, 6, DTYPE) \
228 } \
229 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000230 case 3: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700231 switch (outputRank) \
232 { \
233 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 0, DTYPE) \
234 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 1, DTYPE) \
235 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 2, DTYPE) \
236 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 3, DTYPE) \
237 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 4, DTYPE) \
238 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 5, DTYPE) \
239 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 3, 6, DTYPE) \
240 } \
241 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000242 case 4: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700243 switch (outputRank) \
244 { \
245 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 0, DTYPE) \
246 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 1, DTYPE) \
247 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 2, DTYPE) \
248 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 3, DTYPE) \
249 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 4, DTYPE) \
250 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 5, DTYPE) \
251 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 4, 6, DTYPE) \
252 } \
253 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000254 case 5: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700255 switch (outputRank) \
256 { \
257 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 0, DTYPE) \
258 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 1, DTYPE) \
259 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 2, DTYPE) \
260 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 3, DTYPE) \
261 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 4, DTYPE) \
262 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 5, DTYPE) \
263 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 5, 6, DTYPE) \
264 } \
265 } \
Jerry Ge9c9c8da2023-07-19 23:08:16 +0000266 case 6: { \
Eric Kunzee5e26762020-10-13 16:11:07 -0700267 switch (outputRank) \
268 { \
269 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 0, DTYPE) \
270 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 1, DTYPE) \
271 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 2, DTYPE) \
272 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 3, DTYPE) \
273 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 4, DTYPE) \
274 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 5, DTYPE) \
275 DEF_FACTORY_TWO_RANK_ONE_TYPE(OP, 6, 6, DTYPE) \
276 } \
277 } \
278 } \
279 }
280
Eric Kunzee5e26762020-10-13 16:11:07 -0700281namespace TosaReference
282{
283
Kevin Chengacb550f2021-06-29 15:32:19 -0700284class SubgraphTraverser;
285class GraphNode;
286
Eric Kunzee5e26762020-10-13 16:11:07 -0700287class OpFactory
288{
289public:
Kevin Chengacb550f2021-06-29 15:32:19 -0700290 static GraphNode* newOp(SubgraphTraverser* sgt,
291 tosa::TosaSerializationHandler* tsh,
Eric Kunzee5e26762020-10-13 16:11:07 -0700292 tosa::Op opType,
293 tosa::TosaAttributeBase* attribute,
Eric Kunzee5e26762020-10-13 16:11:07 -0700294 uint64_t id,
Tai Lya4d748b2023-03-28 22:06:56 +0000295 TOSA_REF_TYPE inputDTYPE,
Eric Kunzee5e26762020-10-13 16:11:07 -0700296 int inputRank,
Tai Lya4d748b2023-03-28 22:06:56 +0000297 TOSA_REF_TYPE outputDTYPE,
Eric Kunzee5e26762020-10-13 16:11:07 -0700298 int outputRank,
Tai Lya4d748b2023-03-28 22:06:56 +0000299 TOSA_REF_TYPE weightDTYPE,
Eric Kunzee5e26762020-10-13 16:11:07 -0700300 int weightRank);
301};
302}; // namespace TosaReference
303
304#endif