1 | if (typeName == "Glow_Pad" ) { |
2 | NodeValue Input; |
3 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4 | |
5 | TypeRef ResultOutTy; |
6 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
7 | |
8 | unsigned_t Mode; |
9 | ASSIGN_VALUE_OR_RETURN_ERR(Mode, loadAttribute<unsigned_t>(dict.at("Mode" ), *this)); |
10 | |
11 | std::vector<int> Pads; |
12 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<int>>(dict.at("Pads" ), *this)); |
13 | |
14 | float Value; |
15 | ASSIGN_VALUE_OR_RETURN_ERR(Value, loadAttribute<float>(dict.at("Value" ), *this)); |
16 | |
17 | PadNode *loadedNode = G_->addNode(new PadNode(opName, ResultOutTy, Input, Mode, Pads, Value)); |
18 | |
19 | if (dict.count("Predicate" )) { |
20 | NodeValue Predicate; |
21 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
22 | loadedNode->setPredicate(Predicate); |
23 | } |
24 | |
25 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
26 | return loadedNode; |
27 | } |
28 | |
29 | if (typeName == "Glow_ConvolutionGrad" ) { |
30 | NodeValue Input; |
31 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
32 | |
33 | NodeValue Filter; |
34 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
35 | |
36 | NodeValue Bias; |
37 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
38 | |
39 | NodeValue OriginalOutputForResult; |
40 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(3))); |
41 | |
42 | NodeValue GradOfOriginalOutputNamedResult; |
43 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(4))); |
44 | |
45 | std::vector<unsigned_t> Kernels; |
46 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
47 | |
48 | std::vector<unsigned_t> Strides; |
49 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
50 | |
51 | std::vector<unsigned_t> Pads; |
52 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
53 | |
54 | unsigned_t Group; |
55 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
56 | |
57 | std::vector<unsigned_t> Dilation; |
58 | ASSIGN_VALUE_OR_RETURN_ERR(Dilation, loadAttribute<std::vector<unsigned_t>>(dict.at("Dilation" ), *this)); |
59 | |
60 | glow::ConvolutionLayout Layout; |
61 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<glow::ConvolutionLayout>(dict.at("Layout" ), *this)); |
62 | |
63 | glow::FusedActivation FusedActivation; |
64 | ASSIGN_VALUE_OR_RETURN_ERR(FusedActivation, loadAttribute<glow::FusedActivation>(dict.at("FusedActivation" ), *this)); |
65 | |
66 | std::vector<float> FusedActivationArgs; |
67 | ASSIGN_VALUE_OR_RETURN_ERR(FusedActivationArgs, loadAttribute<std::vector<float>>(dict.at("FusedActivationArgs" ), *this)); |
68 | |
69 | ConvolutionGradNode *loadedNode = G_->addNode(new ConvolutionGradNode(opName, Input, Filter, Bias, OriginalOutputForResult, GradOfOriginalOutputNamedResult, Kernels, Strides, Pads, Group, Dilation, Layout, FusedActivation, FusedActivationArgs)); |
70 | |
71 | if (dict.count("Predicate" )) { |
72 | NodeValue Predicate; |
73 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
74 | loadedNode->setPredicate(Predicate); |
75 | } |
76 | |
77 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
78 | return loadedNode; |
79 | } |
80 | |
81 | if (typeName == "Glow_Convolution" ) { |
82 | NodeValue Input; |
83 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
84 | |
85 | NodeValue Filter; |
86 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
87 | |
88 | NodeValue Bias; |
89 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
90 | |
91 | TypeRef ResultOutTy; |
92 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
93 | |
94 | std::vector<unsigned_t> Kernels; |
95 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
96 | |
97 | std::vector<unsigned_t> Strides; |
98 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
99 | |
100 | std::vector<unsigned_t> Pads; |
101 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
102 | |
103 | unsigned_t Group; |
104 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
105 | |
106 | std::vector<unsigned_t> Dilation; |
107 | ASSIGN_VALUE_OR_RETURN_ERR(Dilation, loadAttribute<std::vector<unsigned_t>>(dict.at("Dilation" ), *this)); |
108 | |
109 | glow::ConvolutionLayout Layout; |
110 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<glow::ConvolutionLayout>(dict.at("Layout" ), *this)); |
111 | |
112 | glow::FusedActivation FusedActivation; |
113 | ASSIGN_VALUE_OR_RETURN_ERR(FusedActivation, loadAttribute<glow::FusedActivation>(dict.at("FusedActivation" ), *this)); |
114 | |
115 | std::vector<float> FusedActivationArgs; |
116 | ASSIGN_VALUE_OR_RETURN_ERR(FusedActivationArgs, loadAttribute<std::vector<float>>(dict.at("FusedActivationArgs" ), *this)); |
117 | |
118 | ConvolutionNode *loadedNode = G_->addNode(new ConvolutionNode(opName, ResultOutTy, Input, Filter, Bias, Kernels, Strides, Pads, Group, Dilation, Layout, FusedActivation, FusedActivationArgs)); |
119 | |
120 | if (dict.count("Predicate" )) { |
121 | NodeValue Predicate; |
122 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
123 | loadedNode->setPredicate(Predicate); |
124 | } |
125 | |
126 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
127 | return loadedNode; |
128 | } |
129 | |
130 | if (typeName == "Glow_ChannelwiseQuantizedConvolution" ) { |
131 | NodeValue Input; |
132 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
133 | |
134 | NodeValue Filter; |
135 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
136 | |
137 | NodeValue Bias; |
138 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
139 | |
140 | NodeValue FilterScales; |
141 | ASSIGN_VALUE_OR_RETURN_ERR(FilterScales, getNodeValueByName(op.input(3))); |
142 | |
143 | NodeValue FilterOffsets; |
144 | ASSIGN_VALUE_OR_RETURN_ERR(FilterOffsets, getNodeValueByName(op.input(4))); |
145 | |
146 | NodeValue BiasScales; |
147 | ASSIGN_VALUE_OR_RETURN_ERR(BiasScales, getNodeValueByName(op.input(5))); |
148 | |
149 | NodeValue BiasOffsets; |
150 | ASSIGN_VALUE_OR_RETURN_ERR(BiasOffsets, getNodeValueByName(op.input(6))); |
151 | |
152 | TypeRef ResultOutTy; |
153 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
154 | |
155 | std::vector<unsigned_t> Kernels; |
156 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
157 | |
158 | std::vector<unsigned_t> Strides; |
159 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
160 | |
161 | std::vector<unsigned_t> Pads; |
162 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
163 | |
164 | unsigned_t Group; |
165 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
166 | |
167 | std::vector<unsigned_t> Dilation; |
168 | ASSIGN_VALUE_OR_RETURN_ERR(Dilation, loadAttribute<std::vector<unsigned_t>>(dict.at("Dilation" ), *this)); |
169 | |
170 | glow::FusedActivation FusedActivation; |
171 | ASSIGN_VALUE_OR_RETURN_ERR(FusedActivation, loadAttribute<glow::FusedActivation>(dict.at("FusedActivation" ), *this)); |
172 | |
173 | std::vector<float> FusedActivationArgs; |
174 | ASSIGN_VALUE_OR_RETURN_ERR(FusedActivationArgs, loadAttribute<std::vector<float>>(dict.at("FusedActivationArgs" ), *this)); |
175 | |
176 | ChannelwiseQuantizedConvolutionNode *loadedNode = G_->addNode(new ChannelwiseQuantizedConvolutionNode(opName, ResultOutTy, Input, Filter, Bias, FilterScales, FilterOffsets, BiasScales, BiasOffsets, Kernels, Strides, Pads, Group, Dilation, FusedActivation, FusedActivationArgs)); |
177 | |
178 | if (dict.count("Predicate" )) { |
179 | NodeValue Predicate; |
180 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
181 | loadedNode->setPredicate(Predicate); |
182 | } |
183 | |
184 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
185 | return loadedNode; |
186 | } |
187 | |
188 | if (typeName == "Glow_ConvTranspose" ) { |
189 | NodeValue Input; |
190 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
191 | |
192 | NodeValue Filter; |
193 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
194 | |
195 | NodeValue Bias; |
196 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
197 | |
198 | TypeRef ResultOutTy; |
199 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
200 | |
201 | std::vector<unsigned_t> Kernels; |
202 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
203 | |
204 | std::vector<unsigned_t> Strides; |
205 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
206 | |
207 | std::vector<unsigned_t> Pads; |
208 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
209 | |
210 | unsigned_t Group; |
211 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
212 | |
213 | std::vector<unsigned_t> Dilation; |
214 | ASSIGN_VALUE_OR_RETURN_ERR(Dilation, loadAttribute<std::vector<unsigned_t>>(dict.at("Dilation" ), *this)); |
215 | |
216 | ConvTransposeNode *loadedNode = G_->addNode(new ConvTransposeNode(opName, ResultOutTy, Input, Filter, Bias, Kernels, Strides, Pads, Group, Dilation)); |
217 | |
218 | if (dict.count("Predicate" )) { |
219 | NodeValue Predicate; |
220 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
221 | loadedNode->setPredicate(Predicate); |
222 | } |
223 | |
224 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
225 | return loadedNode; |
226 | } |
227 | |
228 | if (typeName == "Glow_Convolution3DGrad" ) { |
229 | NodeValue Input; |
230 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
231 | |
232 | NodeValue Filter; |
233 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
234 | |
235 | NodeValue Bias; |
236 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
237 | |
238 | NodeValue OriginalOutputForResult; |
239 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(3))); |
240 | |
241 | NodeValue GradOfOriginalOutputNamedResult; |
242 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(4))); |
243 | |
244 | std::vector<unsigned_t> Kernels; |
245 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
246 | |
247 | std::vector<unsigned_t> Strides; |
248 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
249 | |
250 | std::vector<unsigned_t> Pads; |
251 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
252 | |
253 | unsigned_t Group; |
254 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
255 | |
256 | Convolution3DGradNode *loadedNode = G_->addNode(new Convolution3DGradNode(opName, Input, Filter, Bias, OriginalOutputForResult, GradOfOriginalOutputNamedResult, Kernels, Strides, Pads, Group)); |
257 | |
258 | if (dict.count("Predicate" )) { |
259 | NodeValue Predicate; |
260 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
261 | loadedNode->setPredicate(Predicate); |
262 | } |
263 | |
264 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
265 | return loadedNode; |
266 | } |
267 | |
268 | if (typeName == "Glow_Convolution3D" ) { |
269 | NodeValue Input; |
270 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
271 | |
272 | NodeValue Filter; |
273 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
274 | |
275 | NodeValue Bias; |
276 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
277 | |
278 | TypeRef ResultOutTy; |
279 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
280 | |
281 | std::vector<unsigned_t> Kernels; |
282 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
283 | |
284 | std::vector<unsigned_t> Strides; |
285 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
286 | |
287 | std::vector<unsigned_t> Pads; |
288 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
289 | |
290 | unsigned_t Group; |
291 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
292 | |
293 | Convolution3DNode *loadedNode = G_->addNode(new Convolution3DNode(opName, ResultOutTy, Input, Filter, Bias, Kernels, Strides, Pads, Group)); |
294 | |
295 | if (dict.count("Predicate" )) { |
296 | NodeValue Predicate; |
297 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
298 | loadedNode->setPredicate(Predicate); |
299 | } |
300 | |
301 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
302 | return loadedNode; |
303 | } |
304 | |
305 | if (typeName == "Glow_MaxPoolGrad" ) { |
306 | NodeValue Input; |
307 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
308 | |
309 | NodeValue OriginalOutputForResult; |
310 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
311 | |
312 | NodeValue GradOfOriginalOutputNamedResult; |
313 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
314 | |
315 | NodeValue OriginalOutputForArgmax; |
316 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForArgmax, getNodeValueByName(op.input(3))); |
317 | |
318 | NodeValue GradOfOriginalOutputNamedArgmax; |
319 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedArgmax, getNodeValueByName(op.input(4))); |
320 | |
321 | std::vector<unsigned_t> Kernels; |
322 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
323 | |
324 | std::vector<unsigned_t> Strides; |
325 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
326 | |
327 | std::vector<unsigned_t> Pads; |
328 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
329 | |
330 | unsigned_t Layout; |
331 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<unsigned_t>(dict.at("Layout" ), *this)); |
332 | |
333 | MaxPoolGradNode *loadedNode = G_->addNode(new MaxPoolGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult, OriginalOutputForArgmax, GradOfOriginalOutputNamedArgmax, Kernels, Strides, Pads, Layout)); |
334 | |
335 | if (dict.count("Predicate" )) { |
336 | NodeValue Predicate; |
337 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
338 | loadedNode->setPredicate(Predicate); |
339 | } |
340 | |
341 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
342 | return loadedNode; |
343 | } |
344 | |
345 | if (typeName == "Glow_MaxPool" ) { |
346 | NodeValue Input; |
347 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
348 | |
349 | TypeRef ResultOutTy; |
350 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
351 | |
352 | TypeRef ArgmaxOutTy; |
353 | ASSIGN_VALUE_OR_RETURN_ERR(ArgmaxOutTy, loadTypeFromAttributes(1, dict)); |
354 | |
355 | std::vector<unsigned_t> Kernels; |
356 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
357 | |
358 | std::vector<unsigned_t> Strides; |
359 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
360 | |
361 | std::vector<unsigned_t> Pads; |
362 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
363 | |
364 | unsigned_t Layout; |
365 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<unsigned_t>(dict.at("Layout" ), *this)); |
366 | |
367 | MaxPoolNode *loadedNode = G_->addNode(new MaxPoolNode(opName, ResultOutTy, ArgmaxOutTy, Input, Kernels, Strides, Pads, Layout)); |
368 | |
369 | if (dict.count("Predicate" )) { |
370 | NodeValue Predicate; |
371 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
372 | loadedNode->setPredicate(Predicate); |
373 | } |
374 | |
375 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
376 | return loadedNode; |
377 | } |
378 | |
379 | if (typeName == "Glow_ArgMax" ) { |
380 | NodeValue Input; |
381 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
382 | |
383 | TypeRef ResultOutTy; |
384 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
385 | |
386 | unsigned_t Axis; |
387 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
388 | |
389 | bool KeepDims; |
390 | ASSIGN_VALUE_OR_RETURN_ERR(KeepDims, loadAttribute<bool>(dict.at("KeepDims" ), *this)); |
391 | |
392 | ArgMaxNode *loadedNode = G_->addNode(new ArgMaxNode(opName, ResultOutTy, Input, Axis, KeepDims)); |
393 | |
394 | if (dict.count("Predicate" )) { |
395 | NodeValue Predicate; |
396 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
397 | loadedNode->setPredicate(Predicate); |
398 | } |
399 | |
400 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
401 | return loadedNode; |
402 | } |
403 | |
404 | if (typeName == "Glow_ArgMin" ) { |
405 | NodeValue Input; |
406 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
407 | |
408 | TypeRef ResultOutTy; |
409 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
410 | |
411 | unsigned_t Axis; |
412 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
413 | |
414 | bool KeepDims; |
415 | ASSIGN_VALUE_OR_RETURN_ERR(KeepDims, loadAttribute<bool>(dict.at("KeepDims" ), *this)); |
416 | |
417 | ArgMinNode *loadedNode = G_->addNode(new ArgMinNode(opName, ResultOutTy, Input, Axis, KeepDims)); |
418 | |
419 | if (dict.count("Predicate" )) { |
420 | NodeValue Predicate; |
421 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
422 | loadedNode->setPredicate(Predicate); |
423 | } |
424 | |
425 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
426 | return loadedNode; |
427 | } |
428 | |
429 | if (typeName == "Glow_AvgPoolGrad" ) { |
430 | NodeValue Input; |
431 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
432 | |
433 | NodeValue OriginalOutputForResult; |
434 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
435 | |
436 | NodeValue GradOfOriginalOutputNamedResult; |
437 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
438 | |
439 | std::vector<unsigned_t> Kernels; |
440 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
441 | |
442 | std::vector<unsigned_t> Strides; |
443 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
444 | |
445 | std::vector<unsigned_t> Pads; |
446 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
447 | |
448 | unsigned_t Layout; |
449 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<unsigned_t>(dict.at("Layout" ), *this)); |
450 | |
451 | bool CountIncludePads; |
452 | ASSIGN_VALUE_OR_RETURN_ERR(CountIncludePads, loadAttribute<bool>(dict.at("CountIncludePads" ), *this)); |
453 | |
454 | AvgPoolGradNode *loadedNode = G_->addNode(new AvgPoolGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult, Kernels, Strides, Pads, Layout, CountIncludePads)); |
455 | |
456 | if (dict.count("Predicate" )) { |
457 | NodeValue Predicate; |
458 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
459 | loadedNode->setPredicate(Predicate); |
460 | } |
461 | |
462 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
463 | return loadedNode; |
464 | } |
465 | |
466 | if (typeName == "Glow_AvgPool" ) { |
467 | NodeValue Input; |
468 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
469 | |
470 | TypeRef ResultOutTy; |
471 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
472 | |
473 | std::vector<unsigned_t> Kernels; |
474 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
475 | |
476 | std::vector<unsigned_t> Strides; |
477 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
478 | |
479 | std::vector<unsigned_t> Pads; |
480 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
481 | |
482 | unsigned_t Layout; |
483 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<unsigned_t>(dict.at("Layout" ), *this)); |
484 | |
485 | bool CountIncludePads; |
486 | ASSIGN_VALUE_OR_RETURN_ERR(CountIncludePads, loadAttribute<bool>(dict.at("CountIncludePads" ), *this)); |
487 | |
488 | AvgPoolNode *loadedNode = G_->addNode(new AvgPoolNode(opName, ResultOutTy, Input, Kernels, Strides, Pads, Layout, CountIncludePads)); |
489 | |
490 | if (dict.count("Predicate" )) { |
491 | NodeValue Predicate; |
492 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
493 | loadedNode->setPredicate(Predicate); |
494 | } |
495 | |
496 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
497 | return loadedNode; |
498 | } |
499 | |
500 | if (typeName == "Glow_AdaptiveAvgPoolGrad" ) { |
501 | NodeValue Input; |
502 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
503 | |
504 | NodeValue OriginalOutputForResult; |
505 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
506 | |
507 | NodeValue GradOfOriginalOutputNamedResult; |
508 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
509 | |
510 | AdaptiveAvgPoolGradNode *loadedNode = G_->addNode(new AdaptiveAvgPoolGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
511 | |
512 | if (dict.count("Predicate" )) { |
513 | NodeValue Predicate; |
514 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
515 | loadedNode->setPredicate(Predicate); |
516 | } |
517 | |
518 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
519 | return loadedNode; |
520 | } |
521 | |
522 | if (typeName == "Glow_AdaptiveAvgPool" ) { |
523 | NodeValue Input; |
524 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
525 | |
526 | TypeRef ResultOutTy; |
527 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
528 | |
529 | AdaptiveAvgPoolNode *loadedNode = G_->addNode(new AdaptiveAvgPoolNode(opName, ResultOutTy, Input)); |
530 | |
531 | if (dict.count("Predicate" )) { |
532 | NodeValue Predicate; |
533 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
534 | loadedNode->setPredicate(Predicate); |
535 | } |
536 | |
537 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
538 | return loadedNode; |
539 | } |
540 | |
541 | if (typeName == "Glow_Gemm" ) { |
542 | NodeValue A; |
543 | ASSIGN_VALUE_OR_RETURN_ERR(A, getNodeValueByName(op.input(0))); |
544 | |
545 | NodeValue B; |
546 | ASSIGN_VALUE_OR_RETURN_ERR(B, getNodeValueByName(op.input(1))); |
547 | |
548 | NodeValue C; |
549 | ASSIGN_VALUE_OR_RETURN_ERR(C, getNodeValueByName(op.input(2))); |
550 | |
551 | TypeRef ResultOutTy; |
552 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
553 | |
554 | float Alpha; |
555 | ASSIGN_VALUE_OR_RETURN_ERR(Alpha, loadAttribute<float>(dict.at("Alpha" ), *this)); |
556 | |
557 | float Beta; |
558 | ASSIGN_VALUE_OR_RETURN_ERR(Beta, loadAttribute<float>(dict.at("Beta" ), *this)); |
559 | |
560 | bool TransposeA; |
561 | ASSIGN_VALUE_OR_RETURN_ERR(TransposeA, loadAttribute<bool>(dict.at("TransposeA" ), *this)); |
562 | |
563 | bool TransposeB; |
564 | ASSIGN_VALUE_OR_RETURN_ERR(TransposeB, loadAttribute<bool>(dict.at("TransposeB" ), *this)); |
565 | |
566 | GemmNode *loadedNode = G_->addNode(new GemmNode(opName, ResultOutTy, A, B, C, Alpha, Beta, TransposeA, TransposeB)); |
567 | |
568 | if (dict.count("Predicate" )) { |
569 | NodeValue Predicate; |
570 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
571 | loadedNode->setPredicate(Predicate); |
572 | } |
573 | |
574 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
575 | return loadedNode; |
576 | } |
577 | |
578 | if (typeName == "Glow_FullyConnectedGrad" ) { |
579 | NodeValue Input; |
580 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
581 | |
582 | NodeValue Weights; |
583 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
584 | |
585 | NodeValue Bias; |
586 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
587 | |
588 | NodeValue OriginalOutputForResult; |
589 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(3))); |
590 | |
591 | NodeValue GradOfOriginalOutputNamedResult; |
592 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(4))); |
593 | |
594 | FullyConnectedGradNode *loadedNode = G_->addNode(new FullyConnectedGradNode(opName, Input, Weights, Bias, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
595 | |
596 | if (dict.count("Predicate" )) { |
597 | NodeValue Predicate; |
598 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
599 | loadedNode->setPredicate(Predicate); |
600 | } |
601 | |
602 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
603 | return loadedNode; |
604 | } |
605 | |
606 | if (typeName == "Glow_FullyConnected" ) { |
607 | NodeValue Input; |
608 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
609 | |
610 | NodeValue Weights; |
611 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
612 | |
613 | NodeValue Bias; |
614 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
615 | |
616 | TypeRef ResultOutTy; |
617 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
618 | |
619 | FullyConnectedNode *loadedNode = G_->addNode(new FullyConnectedNode(opName, ResultOutTy, Input, Weights, Bias)); |
620 | |
621 | if (dict.count("Predicate" )) { |
622 | NodeValue Predicate; |
623 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
624 | loadedNode->setPredicate(Predicate); |
625 | } |
626 | |
627 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
628 | return loadedNode; |
629 | } |
630 | |
631 | if (typeName == "Glow_RowwiseQuantizedFullyConnected" ) { |
632 | NodeValue Input; |
633 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
634 | |
635 | NodeValue Weights; |
636 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
637 | |
638 | NodeValue Scales; |
639 | ASSIGN_VALUE_OR_RETURN_ERR(Scales, getNodeValueByName(op.input(2))); |
640 | |
641 | NodeValue Offsets; |
642 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(3))); |
643 | |
644 | NodeValue Bias; |
645 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(4))); |
646 | |
647 | TypeRef ResultOutTy; |
648 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
649 | |
650 | RowwiseQuantizedFullyConnectedNode *loadedNode = G_->addNode(new RowwiseQuantizedFullyConnectedNode(opName, ResultOutTy, Input, Weights, Scales, Offsets, Bias)); |
651 | |
652 | if (dict.count("Predicate" )) { |
653 | NodeValue Predicate; |
654 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
655 | loadedNode->setPredicate(Predicate); |
656 | } |
657 | |
658 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
659 | return loadedNode; |
660 | } |
661 | |
662 | if (typeName == "Glow_DynamicQuantizedFullyConnected" ) { |
663 | NodeValue Input; |
664 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
665 | |
666 | NodeValue Weights; |
667 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
668 | |
669 | NodeValue Bias; |
670 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
671 | |
672 | TypeRef ResultOutTy; |
673 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
674 | |
675 | bool IsSymmetric; |
676 | ASSIGN_VALUE_OR_RETURN_ERR(IsSymmetric, loadAttribute<bool>(dict.at("IsSymmetric" ), *this)); |
677 | |
678 | bool IsPerBatchElement; |
679 | ASSIGN_VALUE_OR_RETURN_ERR(IsPerBatchElement, loadAttribute<bool>(dict.at("IsPerBatchElement" ), *this)); |
680 | |
681 | DynamicQuantizedFullyConnectedNode *loadedNode = G_->addNode(new DynamicQuantizedFullyConnectedNode(opName, ResultOutTy, Input, Weights, Bias, IsSymmetric, IsPerBatchElement)); |
682 | |
683 | if (dict.count("Predicate" )) { |
684 | NodeValue Predicate; |
685 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
686 | loadedNode->setPredicate(Predicate); |
687 | } |
688 | |
689 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
690 | return loadedNode; |
691 | } |
692 | |
693 | if (typeName == "Glow_DynamicRowwiseQuantizedFullyConnected" ) { |
694 | NodeValue Input; |
695 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
696 | |
697 | NodeValue Weights; |
698 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
699 | |
700 | NodeValue Bias; |
701 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
702 | |
703 | NodeValue Scales; |
704 | ASSIGN_VALUE_OR_RETURN_ERR(Scales, getNodeValueByName(op.input(3))); |
705 | |
706 | NodeValue Offsets; |
707 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(4))); |
708 | |
709 | TypeRef ResultOutTy; |
710 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
711 | |
712 | bool IsSymmetric; |
713 | ASSIGN_VALUE_OR_RETURN_ERR(IsSymmetric, loadAttribute<bool>(dict.at("IsSymmetric" ), *this)); |
714 | |
715 | bool IsPerBatchElement; |
716 | ASSIGN_VALUE_OR_RETURN_ERR(IsPerBatchElement, loadAttribute<bool>(dict.at("IsPerBatchElement" ), *this)); |
717 | |
718 | DynamicRowwiseQuantizedFullyConnectedNode *loadedNode = G_->addNode(new DynamicRowwiseQuantizedFullyConnectedNode(opName, ResultOutTy, Input, Weights, Bias, Scales, Offsets, IsSymmetric, IsPerBatchElement)); |
719 | |
720 | if (dict.count("Predicate" )) { |
721 | NodeValue Predicate; |
722 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
723 | loadedNode->setPredicate(Predicate); |
724 | } |
725 | |
726 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
727 | return loadedNode; |
728 | } |
729 | |
730 | if (typeName == "Glow_BatchNormalizationGrad" ) { |
731 | NodeValue Input; |
732 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
733 | |
734 | NodeValue Scale; |
735 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, getNodeValueByName(op.input(1))); |
736 | |
737 | NodeValue Bias; |
738 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
739 | |
740 | NodeValue Mean; |
741 | ASSIGN_VALUE_OR_RETURN_ERR(Mean, getNodeValueByName(op.input(3))); |
742 | |
743 | NodeValue Var; |
744 | ASSIGN_VALUE_OR_RETURN_ERR(Var, getNodeValueByName(op.input(4))); |
745 | |
746 | NodeValue OriginalOutputForResult; |
747 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(5))); |
748 | |
749 | NodeValue GradOfOriginalOutputNamedResult; |
750 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(6))); |
751 | |
752 | unsigned_t ChannelIdx; |
753 | ASSIGN_VALUE_OR_RETURN_ERR(ChannelIdx, loadAttribute<unsigned_t>(dict.at("ChannelIdx" ), *this)); |
754 | |
755 | float Epsilon; |
756 | ASSIGN_VALUE_OR_RETURN_ERR(Epsilon, loadAttribute<float>(dict.at("Epsilon" ), *this)); |
757 | |
758 | float Momentum; |
759 | ASSIGN_VALUE_OR_RETURN_ERR(Momentum, loadAttribute<float>(dict.at("Momentum" ), *this)); |
760 | |
761 | BatchNormalizationGradNode *loadedNode = G_->addNode(new BatchNormalizationGradNode(opName, Input, Scale, Bias, Mean, Var, OriginalOutputForResult, GradOfOriginalOutputNamedResult, ChannelIdx, Epsilon, Momentum)); |
762 | |
763 | if (dict.count("Predicate" )) { |
764 | NodeValue Predicate; |
765 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
766 | loadedNode->setPredicate(Predicate); |
767 | } |
768 | |
769 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
770 | return loadedNode; |
771 | } |
772 | |
773 | if (typeName == "Glow_BatchNormalization" ) { |
774 | NodeValue Input; |
775 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
776 | |
777 | NodeValue Scale; |
778 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, getNodeValueByName(op.input(1))); |
779 | |
780 | NodeValue Bias; |
781 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
782 | |
783 | NodeValue Mean; |
784 | ASSIGN_VALUE_OR_RETURN_ERR(Mean, getNodeValueByName(op.input(3))); |
785 | |
786 | NodeValue Var; |
787 | ASSIGN_VALUE_OR_RETURN_ERR(Var, getNodeValueByName(op.input(4))); |
788 | |
789 | TypeRef ResultOutTy; |
790 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
791 | |
792 | unsigned_t ChannelIdx; |
793 | ASSIGN_VALUE_OR_RETURN_ERR(ChannelIdx, loadAttribute<unsigned_t>(dict.at("ChannelIdx" ), *this)); |
794 | |
795 | float Epsilon; |
796 | ASSIGN_VALUE_OR_RETURN_ERR(Epsilon, loadAttribute<float>(dict.at("Epsilon" ), *this)); |
797 | |
798 | float Momentum; |
799 | ASSIGN_VALUE_OR_RETURN_ERR(Momentum, loadAttribute<float>(dict.at("Momentum" ), *this)); |
800 | |
801 | BatchNormalizationNode *loadedNode = G_->addNode(new BatchNormalizationNode(opName, ResultOutTy, Input, Scale, Bias, Mean, Var, ChannelIdx, Epsilon, Momentum)); |
802 | |
803 | if (dict.count("Predicate" )) { |
804 | NodeValue Predicate; |
805 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
806 | loadedNode->setPredicate(Predicate); |
807 | } |
808 | |
809 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
810 | return loadedNode; |
811 | } |
812 | |
813 | if (typeName == "Glow_InstanceNormalization" ) { |
814 | NodeValue Input; |
815 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
816 | |
817 | NodeValue Scale; |
818 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, getNodeValueByName(op.input(1))); |
819 | |
820 | NodeValue Bias; |
821 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
822 | |
823 | unsigned_t ChannelIdx; |
824 | ASSIGN_VALUE_OR_RETURN_ERR(ChannelIdx, loadAttribute<unsigned_t>(dict.at("ChannelIdx" ), *this)); |
825 | |
826 | float Epsilon; |
827 | ASSIGN_VALUE_OR_RETURN_ERR(Epsilon, loadAttribute<float>(dict.at("Epsilon" ), *this)); |
828 | |
829 | InstanceNormalizationNode *loadedNode = G_->addNode(new InstanceNormalizationNode(opName, Input, Scale, Bias, ChannelIdx, Epsilon)); |
830 | |
831 | if (dict.count("Predicate" )) { |
832 | NodeValue Predicate; |
833 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
834 | loadedNode->setPredicate(Predicate); |
835 | } |
836 | |
837 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
838 | return loadedNode; |
839 | } |
840 | |
841 | if (typeName == "Glow_MeanVarNormalization" ) { |
842 | NodeValue Input; |
843 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
844 | |
845 | NodeValue Mean; |
846 | ASSIGN_VALUE_OR_RETURN_ERR(Mean, getNodeValueByName(op.input(1))); |
847 | |
848 | NodeValue Var; |
849 | ASSIGN_VALUE_OR_RETURN_ERR(Var, getNodeValueByName(op.input(2))); |
850 | |
851 | unsigned_t ChannelIdx; |
852 | ASSIGN_VALUE_OR_RETURN_ERR(ChannelIdx, loadAttribute<unsigned_t>(dict.at("ChannelIdx" ), *this)); |
853 | |
854 | float Momentum; |
855 | ASSIGN_VALUE_OR_RETURN_ERR(Momentum, loadAttribute<float>(dict.at("Momentum" ), *this)); |
856 | |
857 | MeanVarNormalizationNode *loadedNode = G_->addNode(new MeanVarNormalizationNode(opName, Input, Mean, Var, ChannelIdx, Momentum)); |
858 | |
859 | if (dict.count("Predicate" )) { |
860 | NodeValue Predicate; |
861 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
862 | loadedNode->setPredicate(Predicate); |
863 | } |
864 | |
865 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
866 | return loadedNode; |
867 | } |
868 | |
869 | if (typeName == "Glow_LocalResponseNormalizationGrad" ) { |
870 | NodeValue Input; |
871 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
872 | |
873 | NodeValue OriginalOutputForResult; |
874 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
875 | |
876 | NodeValue GradOfOriginalOutputNamedResult; |
877 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
878 | |
879 | unsigned_t HalfWindowSize; |
880 | ASSIGN_VALUE_OR_RETURN_ERR(HalfWindowSize, loadAttribute<unsigned_t>(dict.at("HalfWindowSize" ), *this)); |
881 | |
882 | float Alpha; |
883 | ASSIGN_VALUE_OR_RETURN_ERR(Alpha, loadAttribute<float>(dict.at("Alpha" ), *this)); |
884 | |
885 | float Beta; |
886 | ASSIGN_VALUE_OR_RETURN_ERR(Beta, loadAttribute<float>(dict.at("Beta" ), *this)); |
887 | |
888 | float K; |
889 | ASSIGN_VALUE_OR_RETURN_ERR(K, loadAttribute<float>(dict.at("K" ), *this)); |
890 | |
891 | LocalResponseNormalizationGradNode *loadedNode = G_->addNode(new LocalResponseNormalizationGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult, HalfWindowSize, Alpha, Beta, K)); |
892 | |
893 | if (dict.count("Predicate" )) { |
894 | NodeValue Predicate; |
895 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
896 | loadedNode->setPredicate(Predicate); |
897 | } |
898 | |
899 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
900 | return loadedNode; |
901 | } |
902 | |
903 | if (typeName == "Glow_LocalResponseNormalization" ) { |
904 | NodeValue Input; |
905 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
906 | |
907 | unsigned_t HalfWindowSize; |
908 | ASSIGN_VALUE_OR_RETURN_ERR(HalfWindowSize, loadAttribute<unsigned_t>(dict.at("HalfWindowSize" ), *this)); |
909 | |
910 | float Alpha; |
911 | ASSIGN_VALUE_OR_RETURN_ERR(Alpha, loadAttribute<float>(dict.at("Alpha" ), *this)); |
912 | |
913 | float Beta; |
914 | ASSIGN_VALUE_OR_RETURN_ERR(Beta, loadAttribute<float>(dict.at("Beta" ), *this)); |
915 | |
916 | float K; |
917 | ASSIGN_VALUE_OR_RETURN_ERR(K, loadAttribute<float>(dict.at("K" ), *this)); |
918 | |
919 | LocalResponseNormalizationNode *loadedNode = G_->addNode(new LocalResponseNormalizationNode(opName, Input, HalfWindowSize, Alpha, Beta, K)); |
920 | |
921 | if (dict.count("Predicate" )) { |
922 | NodeValue Predicate; |
923 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
924 | loadedNode->setPredicate(Predicate); |
925 | } |
926 | |
927 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
928 | return loadedNode; |
929 | } |
930 | |
931 | if (typeName == "Glow_LayerNormalization" ) { |
932 | NodeValue Input; |
933 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
934 | |
935 | NodeValue Scale; |
936 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, getNodeValueByName(op.input(1))); |
937 | |
938 | NodeValue Bias; |
939 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
940 | |
941 | TypeRef ResultOutTy; |
942 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
943 | |
944 | float Epsilon; |
945 | ASSIGN_VALUE_OR_RETURN_ERR(Epsilon, loadAttribute<float>(dict.at("Epsilon" ), *this)); |
946 | |
947 | LayerNormalizationNode *loadedNode = G_->addNode(new LayerNormalizationNode(opName, ResultOutTy, Input, Scale, Bias, Epsilon)); |
948 | |
949 | if (dict.count("Predicate" )) { |
950 | NodeValue Predicate; |
951 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
952 | loadedNode->setPredicate(Predicate); |
953 | } |
954 | |
955 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
956 | return loadedNode; |
957 | } |
958 | |
959 | if (typeName == "Glow_BatchBoxCox" ) { |
960 | NodeValue Input; |
961 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
962 | |
963 | NodeValue Lambda1; |
964 | ASSIGN_VALUE_OR_RETURN_ERR(Lambda1, getNodeValueByName(op.input(1))); |
965 | |
966 | NodeValue Lambda2; |
967 | ASSIGN_VALUE_OR_RETURN_ERR(Lambda2, getNodeValueByName(op.input(2))); |
968 | |
969 | float Epsilon; |
970 | ASSIGN_VALUE_OR_RETURN_ERR(Epsilon, loadAttribute<float>(dict.at("Epsilon" ), *this)); |
971 | |
972 | BatchBoxCoxNode *loadedNode = G_->addNode(new BatchBoxCoxNode(opName, Input, Lambda1, Lambda2, Epsilon)); |
973 | |
974 | if (dict.count("Predicate" )) { |
975 | NodeValue Predicate; |
976 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
977 | loadedNode->setPredicate(Predicate); |
978 | } |
979 | |
980 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
981 | return loadedNode; |
982 | } |
983 | |
984 | if (typeName == "Glow_VectorNorm" ) { |
985 | NodeValue Input; |
986 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
987 | |
988 | TypeRef ResultOutTy; |
989 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
990 | |
991 | unsigned_t Axis; |
992 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
993 | |
994 | unsigned_t P; |
995 | ASSIGN_VALUE_OR_RETURN_ERR(P, loadAttribute<unsigned_t>(dict.at("P" ), *this)); |
996 | |
997 | VectorNormNode *loadedNode = G_->addNode(new VectorNormNode(opName, ResultOutTy, Input, Axis, P)); |
998 | |
999 | if (dict.count("Predicate" )) { |
1000 | NodeValue Predicate; |
1001 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1002 | loadedNode->setPredicate(Predicate); |
1003 | } |
1004 | |
1005 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1006 | return loadedNode; |
1007 | } |
1008 | |
1009 | if (typeName == "Glow_Bucketize" ) { |
1010 | NodeValue Input; |
1011 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1012 | |
1013 | TypeRef ResultOutTy; |
1014 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1015 | |
1016 | std::vector<float> Boundaries; |
1017 | ASSIGN_VALUE_OR_RETURN_ERR(Boundaries, loadAttribute<std::vector<float>>(dict.at("Boundaries" ), *this)); |
1018 | |
1019 | BucketizeNode *loadedNode = G_->addNode(new BucketizeNode(opName, ResultOutTy, Input, Boundaries)); |
1020 | |
1021 | if (dict.count("Predicate" )) { |
1022 | NodeValue Predicate; |
1023 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1024 | loadedNode->setPredicate(Predicate); |
1025 | } |
1026 | |
1027 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1028 | return loadedNode; |
1029 | } |
1030 | |
1031 | if (typeName == "Glow_SoftMaxGrad" ) { |
1032 | NodeValue Input; |
1033 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1034 | |
1035 | NodeValue Selected; |
1036 | ASSIGN_VALUE_OR_RETURN_ERR(Selected, getNodeValueByName(op.input(1))); |
1037 | |
1038 | NodeValue OriginalOutputForResult; |
1039 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1040 | |
1041 | NodeValue GradOfOriginalOutputNamedResult; |
1042 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1043 | |
1044 | SoftMaxGradNode *loadedNode = G_->addNode(new SoftMaxGradNode(opName, Input, Selected, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1045 | |
1046 | if (dict.count("Predicate" )) { |
1047 | NodeValue Predicate; |
1048 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1049 | loadedNode->setPredicate(Predicate); |
1050 | } |
1051 | |
1052 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1053 | return loadedNode; |
1054 | } |
1055 | |
1056 | if (typeName == "Glow_SoftMax" ) { |
1057 | NodeValue Input; |
1058 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1059 | |
1060 | NodeValue Selected; |
1061 | ASSIGN_VALUE_OR_RETURN_ERR(Selected, getNodeValueByName(op.input(1))); |
1062 | |
1063 | TypeRef ResultOutTy; |
1064 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1065 | |
1066 | SoftMaxNode *loadedNode = G_->addNode(new SoftMaxNode(opName, ResultOutTy, Input, Selected)); |
1067 | |
1068 | if (dict.count("Predicate" )) { |
1069 | NodeValue Predicate; |
1070 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1071 | loadedNode->setPredicate(Predicate); |
1072 | } |
1073 | |
1074 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1075 | return loadedNode; |
1076 | } |
1077 | |
1078 | if (typeName == "Glow_LogSoftMaxGrad" ) { |
1079 | NodeValue Input; |
1080 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1081 | |
1082 | NodeValue Selected; |
1083 | ASSIGN_VALUE_OR_RETURN_ERR(Selected, getNodeValueByName(op.input(1))); |
1084 | |
1085 | NodeValue OriginalOutputForResult; |
1086 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1087 | |
1088 | NodeValue GradOfOriginalOutputNamedResult; |
1089 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1090 | |
1091 | LogSoftMaxGradNode *loadedNode = G_->addNode(new LogSoftMaxGradNode(opName, Input, Selected, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1092 | |
1093 | if (dict.count("Predicate" )) { |
1094 | NodeValue Predicate; |
1095 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1096 | loadedNode->setPredicate(Predicate); |
1097 | } |
1098 | |
1099 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1100 | return loadedNode; |
1101 | } |
1102 | |
1103 | if (typeName == "Glow_LogSoftMax" ) { |
1104 | NodeValue Input; |
1105 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1106 | |
1107 | NodeValue Selected; |
1108 | ASSIGN_VALUE_OR_RETURN_ERR(Selected, getNodeValueByName(op.input(1))); |
1109 | |
1110 | TypeRef ResultOutTy; |
1111 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1112 | |
1113 | LogSoftMaxNode *loadedNode = G_->addNode(new LogSoftMaxNode(opName, ResultOutTy, Input, Selected)); |
1114 | |
1115 | if (dict.count("Predicate" )) { |
1116 | NodeValue Predicate; |
1117 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1118 | loadedNode->setPredicate(Predicate); |
1119 | } |
1120 | |
1121 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1122 | return loadedNode; |
1123 | } |
1124 | |
1125 | if (typeName == "Glow_CrossEntropyLossGrad" ) { |
1126 | NodeValue P; |
1127 | ASSIGN_VALUE_OR_RETURN_ERR(P, getNodeValueByName(op.input(0))); |
1128 | |
1129 | NodeValue Labels; |
1130 | ASSIGN_VALUE_OR_RETURN_ERR(Labels, getNodeValueByName(op.input(1))); |
1131 | |
1132 | NodeValue OriginalOutputForCE; |
1133 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForCE, getNodeValueByName(op.input(2))); |
1134 | |
1135 | NodeValue GradOfOriginalOutputNamedCE; |
1136 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedCE, getNodeValueByName(op.input(3))); |
1137 | |
1138 | CrossEntropyLossGradNode *loadedNode = G_->addNode(new CrossEntropyLossGradNode(opName, P, Labels, OriginalOutputForCE, GradOfOriginalOutputNamedCE)); |
1139 | |
1140 | if (dict.count("Predicate" )) { |
1141 | NodeValue Predicate; |
1142 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1143 | loadedNode->setPredicate(Predicate); |
1144 | } |
1145 | |
1146 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1147 | return loadedNode; |
1148 | } |
1149 | |
1150 | if (typeName == "Glow_CrossEntropyLoss" ) { |
1151 | NodeValue P; |
1152 | ASSIGN_VALUE_OR_RETURN_ERR(P, getNodeValueByName(op.input(0))); |
1153 | |
1154 | NodeValue Labels; |
1155 | ASSIGN_VALUE_OR_RETURN_ERR(Labels, getNodeValueByName(op.input(1))); |
1156 | |
1157 | TypeRef CEOutTy; |
1158 | ASSIGN_VALUE_OR_RETURN_ERR(CEOutTy, loadTypeFromAttributes(0, dict)); |
1159 | |
1160 | CrossEntropyLossNode *loadedNode = G_->addNode(new CrossEntropyLossNode(opName, CEOutTy, P, Labels)); |
1161 | |
1162 | if (dict.count("Predicate" )) { |
1163 | NodeValue Predicate; |
1164 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1165 | loadedNode->setPredicate(Predicate); |
1166 | } |
1167 | |
1168 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1169 | return loadedNode; |
1170 | } |
1171 | |
1172 | if (typeName == "Glow_RegressionGrad" ) { |
1173 | NodeValue Input; |
1174 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1175 | |
1176 | NodeValue Expected; |
1177 | ASSIGN_VALUE_OR_RETURN_ERR(Expected, getNodeValueByName(op.input(1))); |
1178 | |
1179 | NodeValue OriginalOutputForResult; |
1180 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1181 | |
1182 | NodeValue GradOfOriginalOutputNamedResult; |
1183 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1184 | |
1185 | RegressionGradNode *loadedNode = G_->addNode(new RegressionGradNode(opName, Input, Expected, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1186 | |
1187 | if (dict.count("Predicate" )) { |
1188 | NodeValue Predicate; |
1189 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1190 | loadedNode->setPredicate(Predicate); |
1191 | } |
1192 | |
1193 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1194 | return loadedNode; |
1195 | } |
1196 | |
1197 | if (typeName == "Glow_Regression" ) { |
1198 | NodeValue Input; |
1199 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1200 | |
1201 | NodeValue Expected; |
1202 | ASSIGN_VALUE_OR_RETURN_ERR(Expected, getNodeValueByName(op.input(1))); |
1203 | |
1204 | RegressionNode *loadedNode = G_->addNode(new RegressionNode(opName, Input, Expected)); |
1205 | |
1206 | if (dict.count("Predicate" )) { |
1207 | NodeValue Predicate; |
1208 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1209 | loadedNode->setPredicate(Predicate); |
1210 | } |
1211 | |
1212 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1213 | return loadedNode; |
1214 | } |
1215 | |
1216 | if (typeName == "Glow_SigmoidCrossEntropyWithLogits" ) { |
1217 | NodeValue Logits; |
1218 | ASSIGN_VALUE_OR_RETURN_ERR(Logits, getNodeValueByName(op.input(0))); |
1219 | |
1220 | NodeValue Targets; |
1221 | ASSIGN_VALUE_OR_RETURN_ERR(Targets, getNodeValueByName(op.input(1))); |
1222 | |
1223 | TypeRef ResultOutTy; |
1224 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1225 | |
1226 | SigmoidCrossEntropyWithLogitsNode *loadedNode = G_->addNode(new SigmoidCrossEntropyWithLogitsNode(opName, ResultOutTy, Logits, Targets)); |
1227 | |
1228 | if (dict.count("Predicate" )) { |
1229 | NodeValue Predicate; |
1230 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1231 | loadedNode->setPredicate(Predicate); |
1232 | } |
1233 | |
1234 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1235 | return loadedNode; |
1236 | } |
1237 | |
1238 | if (typeName == "Glow_AddGrad" ) { |
1239 | NodeValue LHS; |
1240 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1241 | |
1242 | NodeValue RHS; |
1243 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1244 | |
1245 | NodeValue OriginalOutputForResult; |
1246 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1247 | |
1248 | NodeValue GradOfOriginalOutputNamedResult; |
1249 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1250 | |
1251 | AddGradNode *loadedNode = G_->addNode(new AddGradNode(opName, LHS, RHS, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1252 | |
1253 | if (dict.count("Predicate" )) { |
1254 | NodeValue Predicate; |
1255 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1256 | loadedNode->setPredicate(Predicate); |
1257 | } |
1258 | |
1259 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1260 | return loadedNode; |
1261 | } |
1262 | |
1263 | if (typeName == "Glow_Add" ) { |
1264 | NodeValue LHS; |
1265 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1266 | |
1267 | NodeValue RHS; |
1268 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1269 | |
1270 | TypeRef ResultOutTy; |
1271 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1272 | |
1273 | AddNode *loadedNode = G_->addNode(new AddNode(opName, ResultOutTy, LHS, RHS)); |
1274 | |
1275 | if (dict.count("Predicate" )) { |
1276 | NodeValue Predicate; |
1277 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1278 | loadedNode->setPredicate(Predicate); |
1279 | } |
1280 | |
1281 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1282 | return loadedNode; |
1283 | } |
1284 | |
1285 | if (typeName == "Glow_MulGrad" ) { |
1286 | NodeValue LHS; |
1287 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1288 | |
1289 | NodeValue RHS; |
1290 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1291 | |
1292 | NodeValue OriginalOutputForResult; |
1293 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1294 | |
1295 | NodeValue GradOfOriginalOutputNamedResult; |
1296 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1297 | |
1298 | MulGradNode *loadedNode = G_->addNode(new MulGradNode(opName, LHS, RHS, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1299 | |
1300 | if (dict.count("Predicate" )) { |
1301 | NodeValue Predicate; |
1302 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1303 | loadedNode->setPredicate(Predicate); |
1304 | } |
1305 | |
1306 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1307 | return loadedNode; |
1308 | } |
1309 | |
1310 | if (typeName == "Glow_Mul" ) { |
1311 | NodeValue LHS; |
1312 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1313 | |
1314 | NodeValue RHS; |
1315 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1316 | |
1317 | TypeRef ResultOutTy; |
1318 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1319 | |
1320 | MulNode *loadedNode = G_->addNode(new MulNode(opName, ResultOutTy, LHS, RHS)); |
1321 | |
1322 | if (dict.count("Predicate" )) { |
1323 | NodeValue Predicate; |
1324 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1325 | loadedNode->setPredicate(Predicate); |
1326 | } |
1327 | |
1328 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1329 | return loadedNode; |
1330 | } |
1331 | |
1332 | if (typeName == "Glow_SubGrad" ) { |
1333 | NodeValue LHS; |
1334 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1335 | |
1336 | NodeValue RHS; |
1337 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1338 | |
1339 | NodeValue OriginalOutputForResult; |
1340 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1341 | |
1342 | NodeValue GradOfOriginalOutputNamedResult; |
1343 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1344 | |
1345 | SubGradNode *loadedNode = G_->addNode(new SubGradNode(opName, LHS, RHS, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1346 | |
1347 | if (dict.count("Predicate" )) { |
1348 | NodeValue Predicate; |
1349 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1350 | loadedNode->setPredicate(Predicate); |
1351 | } |
1352 | |
1353 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1354 | return loadedNode; |
1355 | } |
1356 | |
1357 | if (typeName == "Glow_Sub" ) { |
1358 | NodeValue LHS; |
1359 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1360 | |
1361 | NodeValue RHS; |
1362 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1363 | |
1364 | TypeRef ResultOutTy; |
1365 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1366 | |
1367 | SubNode *loadedNode = G_->addNode(new SubNode(opName, ResultOutTy, LHS, RHS)); |
1368 | |
1369 | if (dict.count("Predicate" )) { |
1370 | NodeValue Predicate; |
1371 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1372 | loadedNode->setPredicate(Predicate); |
1373 | } |
1374 | |
1375 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1376 | return loadedNode; |
1377 | } |
1378 | |
1379 | if (typeName == "Glow_DivGrad" ) { |
1380 | NodeValue LHS; |
1381 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1382 | |
1383 | NodeValue RHS; |
1384 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1385 | |
1386 | NodeValue OriginalOutputForResult; |
1387 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(2))); |
1388 | |
1389 | NodeValue GradOfOriginalOutputNamedResult; |
1390 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(3))); |
1391 | |
1392 | DivGradNode *loadedNode = G_->addNode(new DivGradNode(opName, LHS, RHS, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
1393 | |
1394 | if (dict.count("Predicate" )) { |
1395 | NodeValue Predicate; |
1396 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1397 | loadedNode->setPredicate(Predicate); |
1398 | } |
1399 | |
1400 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1401 | return loadedNode; |
1402 | } |
1403 | |
1404 | if (typeName == "Glow_Div" ) { |
1405 | NodeValue LHS; |
1406 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1407 | |
1408 | NodeValue RHS; |
1409 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1410 | |
1411 | TypeRef ResultOutTy; |
1412 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1413 | |
1414 | DivNode *loadedNode = G_->addNode(new DivNode(opName, ResultOutTy, LHS, RHS)); |
1415 | |
1416 | if (dict.count("Predicate" )) { |
1417 | NodeValue Predicate; |
1418 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1419 | loadedNode->setPredicate(Predicate); |
1420 | } |
1421 | |
1422 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1423 | return loadedNode; |
1424 | } |
1425 | |
1426 | if (typeName == "Glow_FloorDiv" ) { |
1427 | NodeValue LHS; |
1428 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1429 | |
1430 | NodeValue RHS; |
1431 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1432 | |
1433 | TypeRef ResultOutTy; |
1434 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1435 | |
1436 | bool Truncate; |
1437 | ASSIGN_VALUE_OR_RETURN_ERR(Truncate, loadAttribute<bool>(dict.at("Truncate" ), *this)); |
1438 | |
1439 | FloorDivNode *loadedNode = G_->addNode(new FloorDivNode(opName, ResultOutTy, LHS, RHS, Truncate)); |
1440 | |
1441 | if (dict.count("Predicate" )) { |
1442 | NodeValue Predicate; |
1443 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1444 | loadedNode->setPredicate(Predicate); |
1445 | } |
1446 | |
1447 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1448 | return loadedNode; |
1449 | } |
1450 | |
1451 | if (typeName == "Glow_Fmod" ) { |
1452 | NodeValue LHS; |
1453 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1454 | |
1455 | NodeValue RHS; |
1456 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1457 | |
1458 | TypeRef ResultOutTy; |
1459 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1460 | |
1461 | FmodNode *loadedNode = G_->addNode(new FmodNode(opName, ResultOutTy, LHS, RHS)); |
1462 | |
1463 | if (dict.count("Predicate" )) { |
1464 | NodeValue Predicate; |
1465 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1466 | loadedNode->setPredicate(Predicate); |
1467 | } |
1468 | |
1469 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1470 | return loadedNode; |
1471 | } |
1472 | |
1473 | if (typeName == "Glow_Max" ) { |
1474 | NodeValue LHS; |
1475 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1476 | |
1477 | NodeValue RHS; |
1478 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1479 | |
1480 | TypeRef ResultOutTy; |
1481 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1482 | |
1483 | MaxNode *loadedNode = G_->addNode(new MaxNode(opName, ResultOutTy, LHS, RHS)); |
1484 | |
1485 | if (dict.count("Predicate" )) { |
1486 | NodeValue Predicate; |
1487 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1488 | loadedNode->setPredicate(Predicate); |
1489 | } |
1490 | |
1491 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1492 | return loadedNode; |
1493 | } |
1494 | |
1495 | if (typeName == "Glow_Min" ) { |
1496 | NodeValue LHS; |
1497 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1498 | |
1499 | NodeValue RHS; |
1500 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1501 | |
1502 | TypeRef ResultOutTy; |
1503 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1504 | |
1505 | MinNode *loadedNode = G_->addNode(new MinNode(opName, ResultOutTy, LHS, RHS)); |
1506 | |
1507 | if (dict.count("Predicate" )) { |
1508 | NodeValue Predicate; |
1509 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1510 | loadedNode->setPredicate(Predicate); |
1511 | } |
1512 | |
1513 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1514 | return loadedNode; |
1515 | } |
1516 | |
1517 | if (typeName == "Glow_CmpEQ" ) { |
1518 | NodeValue LHS; |
1519 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1520 | |
1521 | NodeValue RHS; |
1522 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1523 | |
1524 | TypeRef ResultOutTy; |
1525 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1526 | |
1527 | CmpEQNode *loadedNode = G_->addNode(new CmpEQNode(opName, ResultOutTy, LHS, RHS)); |
1528 | |
1529 | if (dict.count("Predicate" )) { |
1530 | NodeValue Predicate; |
1531 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1532 | loadedNode->setPredicate(Predicate); |
1533 | } |
1534 | |
1535 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1536 | return loadedNode; |
1537 | } |
1538 | |
1539 | if (typeName == "Glow_CmpNEQ" ) { |
1540 | NodeValue LHS; |
1541 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1542 | |
1543 | NodeValue RHS; |
1544 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1545 | |
1546 | TypeRef ResultOutTy; |
1547 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1548 | |
1549 | CmpNEQNode *loadedNode = G_->addNode(new CmpNEQNode(opName, ResultOutTy, LHS, RHS)); |
1550 | |
1551 | if (dict.count("Predicate" )) { |
1552 | NodeValue Predicate; |
1553 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1554 | loadedNode->setPredicate(Predicate); |
1555 | } |
1556 | |
1557 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1558 | return loadedNode; |
1559 | } |
1560 | |
1561 | if (typeName == "Glow_CmpLT" ) { |
1562 | NodeValue LHS; |
1563 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1564 | |
1565 | NodeValue RHS; |
1566 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1567 | |
1568 | TypeRef ResultOutTy; |
1569 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1570 | |
1571 | CmpLTNode *loadedNode = G_->addNode(new CmpLTNode(opName, ResultOutTy, LHS, RHS)); |
1572 | |
1573 | if (dict.count("Predicate" )) { |
1574 | NodeValue Predicate; |
1575 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1576 | loadedNode->setPredicate(Predicate); |
1577 | } |
1578 | |
1579 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1580 | return loadedNode; |
1581 | } |
1582 | |
1583 | if (typeName == "Glow_CmpLTE" ) { |
1584 | NodeValue LHS; |
1585 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1586 | |
1587 | NodeValue RHS; |
1588 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1589 | |
1590 | TypeRef ResultOutTy; |
1591 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1592 | |
1593 | CmpLTENode *loadedNode = G_->addNode(new CmpLTENode(opName, ResultOutTy, LHS, RHS)); |
1594 | |
1595 | if (dict.count("Predicate" )) { |
1596 | NodeValue Predicate; |
1597 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1598 | loadedNode->setPredicate(Predicate); |
1599 | } |
1600 | |
1601 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1602 | return loadedNode; |
1603 | } |
1604 | |
1605 | if (typeName == "Glow_Pow" ) { |
1606 | NodeValue LHS; |
1607 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1608 | |
1609 | NodeValue RHS; |
1610 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1611 | |
1612 | TypeRef ResultOutTy; |
1613 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1614 | |
1615 | PowNode *loadedNode = G_->addNode(new PowNode(opName, ResultOutTy, LHS, RHS)); |
1616 | |
1617 | if (dict.count("Predicate" )) { |
1618 | NodeValue Predicate; |
1619 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1620 | loadedNode->setPredicate(Predicate); |
1621 | } |
1622 | |
1623 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1624 | return loadedNode; |
1625 | } |
1626 | |
1627 | if (typeName == "Glow_And" ) { |
1628 | NodeValue LHS; |
1629 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1630 | |
1631 | NodeValue RHS; |
1632 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1633 | |
1634 | TypeRef ResultOutTy; |
1635 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1636 | |
1637 | AndNode *loadedNode = G_->addNode(new AndNode(opName, ResultOutTy, LHS, RHS)); |
1638 | |
1639 | if (dict.count("Predicate" )) { |
1640 | NodeValue Predicate; |
1641 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1642 | loadedNode->setPredicate(Predicate); |
1643 | } |
1644 | |
1645 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1646 | return loadedNode; |
1647 | } |
1648 | |
1649 | if (typeName == "Glow_BitwiseAnd" ) { |
1650 | NodeValue LHS; |
1651 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1652 | |
1653 | NodeValue RHS; |
1654 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1655 | |
1656 | TypeRef ResultOutTy; |
1657 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1658 | |
1659 | BitwiseAndNode *loadedNode = G_->addNode(new BitwiseAndNode(opName, ResultOutTy, LHS, RHS)); |
1660 | |
1661 | if (dict.count("Predicate" )) { |
1662 | NodeValue Predicate; |
1663 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1664 | loadedNode->setPredicate(Predicate); |
1665 | } |
1666 | |
1667 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1668 | return loadedNode; |
1669 | } |
1670 | |
1671 | if (typeName == "Glow_Or" ) { |
1672 | NodeValue LHS; |
1673 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1674 | |
1675 | NodeValue RHS; |
1676 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1677 | |
1678 | TypeRef ResultOutTy; |
1679 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1680 | |
1681 | OrNode *loadedNode = G_->addNode(new OrNode(opName, ResultOutTy, LHS, RHS)); |
1682 | |
1683 | if (dict.count("Predicate" )) { |
1684 | NodeValue Predicate; |
1685 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1686 | loadedNode->setPredicate(Predicate); |
1687 | } |
1688 | |
1689 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1690 | return loadedNode; |
1691 | } |
1692 | |
1693 | if (typeName == "Glow_BitwiseOr" ) { |
1694 | NodeValue LHS; |
1695 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1696 | |
1697 | NodeValue RHS; |
1698 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1699 | |
1700 | TypeRef ResultOutTy; |
1701 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1702 | |
1703 | BitwiseOrNode *loadedNode = G_->addNode(new BitwiseOrNode(opName, ResultOutTy, LHS, RHS)); |
1704 | |
1705 | if (dict.count("Predicate" )) { |
1706 | NodeValue Predicate; |
1707 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1708 | loadedNode->setPredicate(Predicate); |
1709 | } |
1710 | |
1711 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1712 | return loadedNode; |
1713 | } |
1714 | |
1715 | if (typeName == "Glow_Xor" ) { |
1716 | NodeValue LHS; |
1717 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1718 | |
1719 | NodeValue RHS; |
1720 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1721 | |
1722 | TypeRef ResultOutTy; |
1723 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1724 | |
1725 | XorNode *loadedNode = G_->addNode(new XorNode(opName, ResultOutTy, LHS, RHS)); |
1726 | |
1727 | if (dict.count("Predicate" )) { |
1728 | NodeValue Predicate; |
1729 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1730 | loadedNode->setPredicate(Predicate); |
1731 | } |
1732 | |
1733 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1734 | return loadedNode; |
1735 | } |
1736 | |
1737 | if (typeName == "Glow_BitwiseXor" ) { |
1738 | NodeValue LHS; |
1739 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
1740 | |
1741 | NodeValue RHS; |
1742 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
1743 | |
1744 | TypeRef ResultOutTy; |
1745 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1746 | |
1747 | BitwiseXorNode *loadedNode = G_->addNode(new BitwiseXorNode(opName, ResultOutTy, LHS, RHS)); |
1748 | |
1749 | if (dict.count("Predicate" )) { |
1750 | NodeValue Predicate; |
1751 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1752 | loadedNode->setPredicate(Predicate); |
1753 | } |
1754 | |
1755 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1756 | return loadedNode; |
1757 | } |
1758 | |
1759 | if (typeName == "Glow_Not" ) { |
1760 | NodeValue Input; |
1761 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1762 | |
1763 | TypeRef ResultOutTy; |
1764 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1765 | |
1766 | NotNode *loadedNode = G_->addNode(new NotNode(opName, ResultOutTy, Input)); |
1767 | |
1768 | if (dict.count("Predicate" )) { |
1769 | NodeValue Predicate; |
1770 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1771 | loadedNode->setPredicate(Predicate); |
1772 | } |
1773 | |
1774 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1775 | return loadedNode; |
1776 | } |
1777 | |
1778 | if (typeName == "Glow_BitwiseNot" ) { |
1779 | NodeValue Input; |
1780 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1781 | |
1782 | TypeRef ResultOutTy; |
1783 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1784 | |
1785 | BitwiseNotNode *loadedNode = G_->addNode(new BitwiseNotNode(opName, ResultOutTy, Input)); |
1786 | |
1787 | if (dict.count("Predicate" )) { |
1788 | NodeValue Predicate; |
1789 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1790 | loadedNode->setPredicate(Predicate); |
1791 | } |
1792 | |
1793 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1794 | return loadedNode; |
1795 | } |
1796 | |
1797 | if (typeName == "Glow_Neg" ) { |
1798 | NodeValue Input; |
1799 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1800 | |
1801 | TypeRef ResultOutTy; |
1802 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1803 | |
1804 | NegNode *loadedNode = G_->addNode(new NegNode(opName, ResultOutTy, Input)); |
1805 | |
1806 | if (dict.count("Predicate" )) { |
1807 | NodeValue Predicate; |
1808 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1809 | loadedNode->setPredicate(Predicate); |
1810 | } |
1811 | |
1812 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1813 | return loadedNode; |
1814 | } |
1815 | |
1816 | if (typeName == "Glow_Abs" ) { |
1817 | NodeValue Input; |
1818 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1819 | |
1820 | TypeRef ResultOutTy; |
1821 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1822 | |
1823 | AbsNode *loadedNode = G_->addNode(new AbsNode(opName, ResultOutTy, Input)); |
1824 | |
1825 | if (dict.count("Predicate" )) { |
1826 | NodeValue Predicate; |
1827 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1828 | loadedNode->setPredicate(Predicate); |
1829 | } |
1830 | |
1831 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1832 | return loadedNode; |
1833 | } |
1834 | |
1835 | if (typeName == "Glow_Floor" ) { |
1836 | NodeValue Input; |
1837 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1838 | |
1839 | TypeRef ResultOutTy; |
1840 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1841 | |
1842 | FloorNode *loadedNode = G_->addNode(new FloorNode(opName, ResultOutTy, Input)); |
1843 | |
1844 | if (dict.count("Predicate" )) { |
1845 | NodeValue Predicate; |
1846 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1847 | loadedNode->setPredicate(Predicate); |
1848 | } |
1849 | |
1850 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1851 | return loadedNode; |
1852 | } |
1853 | |
1854 | if (typeName == "Glow_Sign" ) { |
1855 | NodeValue Input; |
1856 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1857 | |
1858 | TypeRef ResultOutTy; |
1859 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1860 | |
1861 | SignNode *loadedNode = G_->addNode(new SignNode(opName, ResultOutTy, Input)); |
1862 | |
1863 | if (dict.count("Predicate" )) { |
1864 | NodeValue Predicate; |
1865 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1866 | loadedNode->setPredicate(Predicate); |
1867 | } |
1868 | |
1869 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1870 | return loadedNode; |
1871 | } |
1872 | |
1873 | if (typeName == "Glow_Ceil" ) { |
1874 | NodeValue Input; |
1875 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1876 | |
1877 | TypeRef ResultOutTy; |
1878 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1879 | |
1880 | CeilNode *loadedNode = G_->addNode(new CeilNode(opName, ResultOutTy, Input)); |
1881 | |
1882 | if (dict.count("Predicate" )) { |
1883 | NodeValue Predicate; |
1884 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1885 | loadedNode->setPredicate(Predicate); |
1886 | } |
1887 | |
1888 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1889 | return loadedNode; |
1890 | } |
1891 | |
1892 | if (typeName == "Glow_Round" ) { |
1893 | NodeValue Input; |
1894 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1895 | |
1896 | TypeRef ResultOutTy; |
1897 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1898 | |
1899 | RoundNode *loadedNode = G_->addNode(new RoundNode(opName, ResultOutTy, Input)); |
1900 | |
1901 | if (dict.count("Predicate" )) { |
1902 | NodeValue Predicate; |
1903 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1904 | loadedNode->setPredicate(Predicate); |
1905 | } |
1906 | |
1907 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1908 | return loadedNode; |
1909 | } |
1910 | |
1911 | if (typeName == "Glow_Truncate" ) { |
1912 | NodeValue Input; |
1913 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1914 | |
1915 | TypeRef ResultOutTy; |
1916 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1917 | |
1918 | TruncateNode *loadedNode = G_->addNode(new TruncateNode(opName, ResultOutTy, Input)); |
1919 | |
1920 | if (dict.count("Predicate" )) { |
1921 | NodeValue Predicate; |
1922 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1923 | loadedNode->setPredicate(Predicate); |
1924 | } |
1925 | |
1926 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1927 | return loadedNode; |
1928 | } |
1929 | |
1930 | if (typeName == "Glow_Sqrt" ) { |
1931 | NodeValue Input; |
1932 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1933 | |
1934 | TypeRef ResultOutTy; |
1935 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1936 | |
1937 | SqrtNode *loadedNode = G_->addNode(new SqrtNode(opName, ResultOutTy, Input)); |
1938 | |
1939 | if (dict.count("Predicate" )) { |
1940 | NodeValue Predicate; |
1941 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1942 | loadedNode->setPredicate(Predicate); |
1943 | } |
1944 | |
1945 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1946 | return loadedNode; |
1947 | } |
1948 | |
1949 | if (typeName == "Glow_Rsqrt" ) { |
1950 | NodeValue Input; |
1951 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1952 | |
1953 | TypeRef ResultOutTy; |
1954 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1955 | |
1956 | RsqrtNode *loadedNode = G_->addNode(new RsqrtNode(opName, ResultOutTy, Input)); |
1957 | |
1958 | if (dict.count("Predicate" )) { |
1959 | NodeValue Predicate; |
1960 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1961 | loadedNode->setPredicate(Predicate); |
1962 | } |
1963 | |
1964 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1965 | return loadedNode; |
1966 | } |
1967 | |
1968 | if (typeName == "Glow_Reciprocal" ) { |
1969 | NodeValue Input; |
1970 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1971 | |
1972 | TypeRef ResultOutTy; |
1973 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1974 | |
1975 | ReciprocalNode *loadedNode = G_->addNode(new ReciprocalNode(opName, ResultOutTy, Input)); |
1976 | |
1977 | if (dict.count("Predicate" )) { |
1978 | NodeValue Predicate; |
1979 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1980 | loadedNode->setPredicate(Predicate); |
1981 | } |
1982 | |
1983 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
1984 | return loadedNode; |
1985 | } |
1986 | |
1987 | if (typeName == "Glow_Sin" ) { |
1988 | NodeValue Input; |
1989 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
1990 | |
1991 | TypeRef ResultOutTy; |
1992 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
1993 | |
1994 | SinNode *loadedNode = G_->addNode(new SinNode(opName, ResultOutTy, Input)); |
1995 | |
1996 | if (dict.count("Predicate" )) { |
1997 | NodeValue Predicate; |
1998 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
1999 | loadedNode->setPredicate(Predicate); |
2000 | } |
2001 | |
2002 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2003 | return loadedNode; |
2004 | } |
2005 | |
2006 | if (typeName == "Glow_Cos" ) { |
2007 | NodeValue Input; |
2008 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2009 | |
2010 | TypeRef ResultOutTy; |
2011 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2012 | |
2013 | CosNode *loadedNode = G_->addNode(new CosNode(opName, ResultOutTy, Input)); |
2014 | |
2015 | if (dict.count("Predicate" )) { |
2016 | NodeValue Predicate; |
2017 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2018 | loadedNode->setPredicate(Predicate); |
2019 | } |
2020 | |
2021 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2022 | return loadedNode; |
2023 | } |
2024 | |
2025 | if (typeName == "Glow_Log" ) { |
2026 | NodeValue Input; |
2027 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2028 | |
2029 | TypeRef ResultOutTy; |
2030 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2031 | |
2032 | LogNode *loadedNode = G_->addNode(new LogNode(opName, ResultOutTy, Input)); |
2033 | |
2034 | if (dict.count("Predicate" )) { |
2035 | NodeValue Predicate; |
2036 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2037 | loadedNode->setPredicate(Predicate); |
2038 | } |
2039 | |
2040 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2041 | return loadedNode; |
2042 | } |
2043 | |
2044 | if (typeName == "Glow_Acos" ) { |
2045 | NodeValue Input; |
2046 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2047 | |
2048 | TypeRef ResultOutTy; |
2049 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2050 | |
2051 | AcosNode *loadedNode = G_->addNode(new AcosNode(opName, ResultOutTy, Input)); |
2052 | |
2053 | if (dict.count("Predicate" )) { |
2054 | NodeValue Predicate; |
2055 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2056 | loadedNode->setPredicate(Predicate); |
2057 | } |
2058 | |
2059 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2060 | return loadedNode; |
2061 | } |
2062 | |
2063 | if (typeName == "Glow_Asin" ) { |
2064 | NodeValue Input; |
2065 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2066 | |
2067 | TypeRef ResultOutTy; |
2068 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2069 | |
2070 | AsinNode *loadedNode = G_->addNode(new AsinNode(opName, ResultOutTy, Input)); |
2071 | |
2072 | if (dict.count("Predicate" )) { |
2073 | NodeValue Predicate; |
2074 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2075 | loadedNode->setPredicate(Predicate); |
2076 | } |
2077 | |
2078 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2079 | return loadedNode; |
2080 | } |
2081 | |
2082 | if (typeName == "Glow_Atan" ) { |
2083 | NodeValue Input; |
2084 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2085 | |
2086 | TypeRef ResultOutTy; |
2087 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2088 | |
2089 | AtanNode *loadedNode = G_->addNode(new AtanNode(opName, ResultOutTy, Input)); |
2090 | |
2091 | if (dict.count("Predicate" )) { |
2092 | NodeValue Predicate; |
2093 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2094 | loadedNode->setPredicate(Predicate); |
2095 | } |
2096 | |
2097 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2098 | return loadedNode; |
2099 | } |
2100 | |
2101 | if (typeName == "Glow_Erf" ) { |
2102 | NodeValue Input; |
2103 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2104 | |
2105 | TypeRef ResultOutTy; |
2106 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2107 | |
2108 | ErfNode *loadedNode = G_->addNode(new ErfNode(opName, ResultOutTy, Input)); |
2109 | |
2110 | if (dict.count("Predicate" )) { |
2111 | NodeValue Predicate; |
2112 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2113 | loadedNode->setPredicate(Predicate); |
2114 | } |
2115 | |
2116 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2117 | return loadedNode; |
2118 | } |
2119 | |
2120 | if (typeName == "Glow_Exp" ) { |
2121 | NodeValue Input; |
2122 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2123 | |
2124 | TypeRef ResultOutTy; |
2125 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2126 | |
2127 | ExpNode *loadedNode = G_->addNode(new ExpNode(opName, ResultOutTy, Input)); |
2128 | |
2129 | if (dict.count("Predicate" )) { |
2130 | NodeValue Predicate; |
2131 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2132 | loadedNode->setPredicate(Predicate); |
2133 | } |
2134 | |
2135 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2136 | return loadedNode; |
2137 | } |
2138 | |
2139 | if (typeName == "Glow_Logit" ) { |
2140 | NodeValue Input; |
2141 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2142 | |
2143 | TypeRef ResultOutTy; |
2144 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2145 | |
2146 | float Epsilon; |
2147 | ASSIGN_VALUE_OR_RETURN_ERR(Epsilon, loadAttribute<float>(dict.at("Epsilon" ), *this)); |
2148 | |
2149 | LogitNode *loadedNode = G_->addNode(new LogitNode(opName, ResultOutTy, Input, Epsilon)); |
2150 | |
2151 | if (dict.count("Predicate" )) { |
2152 | NodeValue Predicate; |
2153 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2154 | loadedNode->setPredicate(Predicate); |
2155 | } |
2156 | |
2157 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2158 | return loadedNode; |
2159 | } |
2160 | |
2161 | if (typeName == "Glow_NonZero" ) { |
2162 | NodeValue Cond; |
2163 | ASSIGN_VALUE_OR_RETURN_ERR(Cond, getNodeValueByName(op.input(0))); |
2164 | |
2165 | TypeRef ResultOutTy; |
2166 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2167 | |
2168 | NonZeroNode *loadedNode = G_->addNode(new NonZeroNode(opName, ResultOutTy, Cond)); |
2169 | |
2170 | if (dict.count("Predicate" )) { |
2171 | NodeValue Predicate; |
2172 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2173 | loadedNode->setPredicate(Predicate); |
2174 | } |
2175 | |
2176 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2177 | return loadedNode; |
2178 | } |
2179 | |
2180 | if (typeName == "Glow_Select" ) { |
2181 | NodeValue Cond; |
2182 | ASSIGN_VALUE_OR_RETURN_ERR(Cond, getNodeValueByName(op.input(0))); |
2183 | |
2184 | NodeValue LHS; |
2185 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(1))); |
2186 | |
2187 | NodeValue RHS; |
2188 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(2))); |
2189 | |
2190 | TypeRef ResultOutTy; |
2191 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2192 | |
2193 | SelectNode *loadedNode = G_->addNode(new SelectNode(opName, ResultOutTy, Cond, LHS, RHS)); |
2194 | |
2195 | if (dict.count("Predicate" )) { |
2196 | NodeValue Predicate; |
2197 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2198 | loadedNode->setPredicate(Predicate); |
2199 | } |
2200 | |
2201 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2202 | return loadedNode; |
2203 | } |
2204 | |
2205 | if (typeName == "Glow_BatchedAdd" ) { |
2206 | NodeValue Batch; |
2207 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2208 | |
2209 | NodeValue Slice; |
2210 | ASSIGN_VALUE_OR_RETURN_ERR(Slice, getNodeValueByName(op.input(1))); |
2211 | |
2212 | TypeRef ResultOutTy; |
2213 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2214 | |
2215 | BatchedAddNode *loadedNode = G_->addNode(new BatchedAddNode(opName, ResultOutTy, Batch, Slice)); |
2216 | |
2217 | if (dict.count("Predicate" )) { |
2218 | NodeValue Predicate; |
2219 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2220 | loadedNode->setPredicate(Predicate); |
2221 | } |
2222 | |
2223 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2224 | return loadedNode; |
2225 | } |
2226 | |
2227 | if (typeName == "Glow_BatchedMul" ) { |
2228 | NodeValue Batch; |
2229 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2230 | |
2231 | NodeValue Slice; |
2232 | ASSIGN_VALUE_OR_RETURN_ERR(Slice, getNodeValueByName(op.input(1))); |
2233 | |
2234 | TypeRef ResultOutTy; |
2235 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2236 | |
2237 | BatchedMulNode *loadedNode = G_->addNode(new BatchedMulNode(opName, ResultOutTy, Batch, Slice)); |
2238 | |
2239 | if (dict.count("Predicate" )) { |
2240 | NodeValue Predicate; |
2241 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2242 | loadedNode->setPredicate(Predicate); |
2243 | } |
2244 | |
2245 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2246 | return loadedNode; |
2247 | } |
2248 | |
2249 | if (typeName == "Glow_MatMul" ) { |
2250 | NodeValue LHS; |
2251 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
2252 | |
2253 | NodeValue RHS; |
2254 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
2255 | |
2256 | TypeRef ResultOutTy; |
2257 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2258 | |
2259 | MatMulNode *loadedNode = G_->addNode(new MatMulNode(opName, ResultOutTy, LHS, RHS)); |
2260 | |
2261 | if (dict.count("Predicate" )) { |
2262 | NodeValue Predicate; |
2263 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2264 | loadedNode->setPredicate(Predicate); |
2265 | } |
2266 | |
2267 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2268 | return loadedNode; |
2269 | } |
2270 | |
2271 | if (typeName == "Glow_BatchMatMul" ) { |
2272 | NodeValue LHS; |
2273 | ASSIGN_VALUE_OR_RETURN_ERR(LHS, getNodeValueByName(op.input(0))); |
2274 | |
2275 | NodeValue RHS; |
2276 | ASSIGN_VALUE_OR_RETURN_ERR(RHS, getNodeValueByName(op.input(1))); |
2277 | |
2278 | TypeRef ResultOutTy; |
2279 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2280 | |
2281 | BatchMatMulNode *loadedNode = G_->addNode(new BatchMatMulNode(opName, ResultOutTy, LHS, RHS)); |
2282 | |
2283 | if (dict.count("Predicate" )) { |
2284 | NodeValue Predicate; |
2285 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2286 | loadedNode->setPredicate(Predicate); |
2287 | } |
2288 | |
2289 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2290 | return loadedNode; |
2291 | } |
2292 | |
2293 | if (typeName == "Glow_BatchedReduceAdd" ) { |
2294 | NodeValue Batch; |
2295 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2296 | |
2297 | TypeRef ResultOutTy; |
2298 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2299 | |
2300 | unsigned_t Axis; |
2301 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
2302 | |
2303 | BatchedReduceAddNode *loadedNode = G_->addNode(new BatchedReduceAddNode(opName, ResultOutTy, Batch, Axis)); |
2304 | |
2305 | if (dict.count("Predicate" )) { |
2306 | NodeValue Predicate; |
2307 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2308 | loadedNode->setPredicate(Predicate); |
2309 | } |
2310 | |
2311 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2312 | return loadedNode; |
2313 | } |
2314 | |
2315 | if (typeName == "Glow_BatchedReduceSumSquare" ) { |
2316 | NodeValue Batch; |
2317 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2318 | |
2319 | TypeRef ResultOutTy; |
2320 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2321 | |
2322 | unsigned_t Axis; |
2323 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
2324 | |
2325 | BatchedReduceSumSquareNode *loadedNode = G_->addNode(new BatchedReduceSumSquareNode(opName, ResultOutTy, Batch, Axis)); |
2326 | |
2327 | if (dict.count("Predicate" )) { |
2328 | NodeValue Predicate; |
2329 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2330 | loadedNode->setPredicate(Predicate); |
2331 | } |
2332 | |
2333 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2334 | return loadedNode; |
2335 | } |
2336 | |
2337 | if (typeName == "Glow_BatchedReduceMean" ) { |
2338 | NodeValue Batch; |
2339 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2340 | |
2341 | TypeRef ResultOutTy; |
2342 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2343 | |
2344 | std::vector<unsigned_t> Axes; |
2345 | ASSIGN_VALUE_OR_RETURN_ERR(Axes, loadAttribute<std::vector<unsigned_t>>(dict.at("Axes" ), *this)); |
2346 | |
2347 | BatchedReduceMeanNode *loadedNode = G_->addNode(new BatchedReduceMeanNode(opName, ResultOutTy, Batch, Axes)); |
2348 | |
2349 | if (dict.count("Predicate" )) { |
2350 | NodeValue Predicate; |
2351 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2352 | loadedNode->setPredicate(Predicate); |
2353 | } |
2354 | |
2355 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2356 | return loadedNode; |
2357 | } |
2358 | |
2359 | if (typeName == "Glow_BatchedReduceMin" ) { |
2360 | NodeValue Batch; |
2361 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2362 | |
2363 | TypeRef ResultOutTy; |
2364 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2365 | |
2366 | std::vector<unsigned_t> Axes; |
2367 | ASSIGN_VALUE_OR_RETURN_ERR(Axes, loadAttribute<std::vector<unsigned_t>>(dict.at("Axes" ), *this)); |
2368 | |
2369 | BatchedReduceMinNode *loadedNode = G_->addNode(new BatchedReduceMinNode(opName, ResultOutTy, Batch, Axes)); |
2370 | |
2371 | if (dict.count("Predicate" )) { |
2372 | NodeValue Predicate; |
2373 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2374 | loadedNode->setPredicate(Predicate); |
2375 | } |
2376 | |
2377 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2378 | return loadedNode; |
2379 | } |
2380 | |
2381 | if (typeName == "Glow_BatchedReduceMax" ) { |
2382 | NodeValue Batch; |
2383 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2384 | |
2385 | TypeRef ResultOutTy; |
2386 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2387 | |
2388 | std::vector<unsigned_t> Axes; |
2389 | ASSIGN_VALUE_OR_RETURN_ERR(Axes, loadAttribute<std::vector<unsigned_t>>(dict.at("Axes" ), *this)); |
2390 | |
2391 | BatchedReduceMaxNode *loadedNode = G_->addNode(new BatchedReduceMaxNode(opName, ResultOutTy, Batch, Axes)); |
2392 | |
2393 | if (dict.count("Predicate" )) { |
2394 | NodeValue Predicate; |
2395 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2396 | loadedNode->setPredicate(Predicate); |
2397 | } |
2398 | |
2399 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2400 | return loadedNode; |
2401 | } |
2402 | |
2403 | if (typeName == "Glow_BatchedReduceProd" ) { |
2404 | NodeValue Batch; |
2405 | ASSIGN_VALUE_OR_RETURN_ERR(Batch, getNodeValueByName(op.input(0))); |
2406 | |
2407 | TypeRef ResultOutTy; |
2408 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2409 | |
2410 | unsigned_t Axis; |
2411 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
2412 | |
2413 | BatchedReduceProdNode *loadedNode = G_->addNode(new BatchedReduceProdNode(opName, ResultOutTy, Batch, Axis)); |
2414 | |
2415 | if (dict.count("Predicate" )) { |
2416 | NodeValue Predicate; |
2417 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2418 | loadedNode->setPredicate(Predicate); |
2419 | } |
2420 | |
2421 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2422 | return loadedNode; |
2423 | } |
2424 | |
2425 | if (typeName == "Glow_ChannelShuffle" ) { |
2426 | NodeValue Input; |
2427 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2428 | |
2429 | TypeRef ResultOutTy; |
2430 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2431 | |
2432 | unsigned_t Group; |
2433 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
2434 | |
2435 | unsigned_t Kernel; |
2436 | ASSIGN_VALUE_OR_RETURN_ERR(Kernel, loadAttribute<unsigned_t>(dict.at("Kernel" ), *this)); |
2437 | |
2438 | ChannelShuffleNode *loadedNode = G_->addNode(new ChannelShuffleNode(opName, ResultOutTy, Input, Group, Kernel)); |
2439 | |
2440 | if (dict.count("Predicate" )) { |
2441 | NodeValue Predicate; |
2442 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2443 | loadedNode->setPredicate(Predicate); |
2444 | } |
2445 | |
2446 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2447 | return loadedNode; |
2448 | } |
2449 | |
2450 | if (typeName == "Glow_CumSum" ) { |
2451 | NodeValue Input; |
2452 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2453 | |
2454 | TypeRef ResultOutTy; |
2455 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2456 | |
2457 | int64_t Dim; |
2458 | ASSIGN_VALUE_OR_RETURN_ERR(Dim, loadAttribute<int64_t>(dict.at("Dim" ), *this)); |
2459 | |
2460 | unsigned_t Exclusive; |
2461 | ASSIGN_VALUE_OR_RETURN_ERR(Exclusive, loadAttribute<unsigned_t>(dict.at("Exclusive" ), *this)); |
2462 | |
2463 | unsigned_t Reverse; |
2464 | ASSIGN_VALUE_OR_RETURN_ERR(Reverse, loadAttribute<unsigned_t>(dict.at("Reverse" ), *this)); |
2465 | |
2466 | CumSumNode *loadedNode = G_->addNode(new CumSumNode(opName, ResultOutTy, Input, Dim, Exclusive, Reverse)); |
2467 | |
2468 | if (dict.count("Predicate" )) { |
2469 | NodeValue Predicate; |
2470 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2471 | loadedNode->setPredicate(Predicate); |
2472 | } |
2473 | |
2474 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2475 | return loadedNode; |
2476 | } |
2477 | |
2478 | if (typeName == "Glow_LengthsSum" ) { |
2479 | NodeValue Data; |
2480 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2481 | |
2482 | NodeValue Lengths; |
2483 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(1))); |
2484 | |
2485 | TypeRef ResultOutTy; |
2486 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2487 | |
2488 | LengthsSumNode *loadedNode = G_->addNode(new LengthsSumNode(opName, ResultOutTy, Data, Lengths)); |
2489 | |
2490 | if (dict.count("Predicate" )) { |
2491 | NodeValue Predicate; |
2492 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2493 | loadedNode->setPredicate(Predicate); |
2494 | } |
2495 | |
2496 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2497 | return loadedNode; |
2498 | } |
2499 | |
2500 | if (typeName == "Glow_SparseLengthsSumGrad" ) { |
2501 | NodeValue Data; |
2502 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2503 | |
2504 | NodeValue Indices; |
2505 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
2506 | |
2507 | NodeValue Lengths; |
2508 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(2))); |
2509 | |
2510 | NodeValue OriginalOutputForResult; |
2511 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(3))); |
2512 | |
2513 | NodeValue GradOfOriginalOutputNamedResult; |
2514 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(4))); |
2515 | |
2516 | glow::LengthsMode LengthsMode; |
2517 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2518 | |
2519 | float AvgLength; |
2520 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2521 | |
2522 | SparseLengthsSumGradNode *loadedNode = G_->addNode(new SparseLengthsSumGradNode(opName, Data, Indices, Lengths, OriginalOutputForResult, GradOfOriginalOutputNamedResult, LengthsMode, AvgLength)); |
2523 | |
2524 | if (dict.count("Predicate" )) { |
2525 | NodeValue Predicate; |
2526 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2527 | loadedNode->setPredicate(Predicate); |
2528 | } |
2529 | |
2530 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2531 | return loadedNode; |
2532 | } |
2533 | |
2534 | if (typeName == "Glow_SparseLengthsSum" ) { |
2535 | NodeValue Data; |
2536 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2537 | |
2538 | NodeValue Indices; |
2539 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
2540 | |
2541 | NodeValue Lengths; |
2542 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(2))); |
2543 | |
2544 | TypeRef ResultOutTy; |
2545 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2546 | |
2547 | glow::LengthsMode LengthsMode; |
2548 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2549 | |
2550 | float AvgLength; |
2551 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2552 | |
2553 | SparseLengthsSumNode *loadedNode = G_->addNode(new SparseLengthsSumNode(opName, ResultOutTy, Data, Indices, Lengths, LengthsMode, AvgLength)); |
2554 | |
2555 | if (dict.count("Predicate" )) { |
2556 | NodeValue Predicate; |
2557 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2558 | loadedNode->setPredicate(Predicate); |
2559 | } |
2560 | |
2561 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2562 | return loadedNode; |
2563 | } |
2564 | |
2565 | if (typeName == "Glow_SparseLengthsWeightedSumGrad" ) { |
2566 | NodeValue Data; |
2567 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2568 | |
2569 | NodeValue Weights; |
2570 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
2571 | |
2572 | NodeValue Indices; |
2573 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(2))); |
2574 | |
2575 | NodeValue Lengths; |
2576 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(3))); |
2577 | |
2578 | NodeValue OriginalOutputForResult; |
2579 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(4))); |
2580 | |
2581 | NodeValue GradOfOriginalOutputNamedResult; |
2582 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(5))); |
2583 | |
2584 | glow::LengthsMode LengthsMode; |
2585 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2586 | |
2587 | float AvgLength; |
2588 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2589 | |
2590 | SparseLengthsWeightedSumGradNode *loadedNode = G_->addNode(new SparseLengthsWeightedSumGradNode(opName, Data, Weights, Indices, Lengths, OriginalOutputForResult, GradOfOriginalOutputNamedResult, LengthsMode, AvgLength)); |
2591 | |
2592 | if (dict.count("Predicate" )) { |
2593 | NodeValue Predicate; |
2594 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2595 | loadedNode->setPredicate(Predicate); |
2596 | } |
2597 | |
2598 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2599 | return loadedNode; |
2600 | } |
2601 | |
2602 | if (typeName == "Glow_SparseLengthsWeightedSum" ) { |
2603 | NodeValue Data; |
2604 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2605 | |
2606 | NodeValue Weights; |
2607 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
2608 | |
2609 | NodeValue Indices; |
2610 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(2))); |
2611 | |
2612 | NodeValue Lengths; |
2613 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(3))); |
2614 | |
2615 | TypeRef ResultOutTy; |
2616 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2617 | |
2618 | glow::LengthsMode LengthsMode; |
2619 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2620 | |
2621 | float AvgLength; |
2622 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2623 | |
2624 | SparseLengthsWeightedSumNode *loadedNode = G_->addNode(new SparseLengthsWeightedSumNode(opName, ResultOutTy, Data, Weights, Indices, Lengths, LengthsMode, AvgLength)); |
2625 | |
2626 | if (dict.count("Predicate" )) { |
2627 | NodeValue Predicate; |
2628 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2629 | loadedNode->setPredicate(Predicate); |
2630 | } |
2631 | |
2632 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2633 | return loadedNode; |
2634 | } |
2635 | |
2636 | if (typeName == "Glow_Embedding" ) { |
2637 | NodeValue Weights; |
2638 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(0))); |
2639 | |
2640 | NodeValue Indices; |
2641 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
2642 | |
2643 | TypeRef ResultOutTy; |
2644 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2645 | |
2646 | int64_t PadIdx; |
2647 | ASSIGN_VALUE_OR_RETURN_ERR(PadIdx, loadAttribute<int64_t>(dict.at("PadIdx" ), *this)); |
2648 | |
2649 | bool Scale; |
2650 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, loadAttribute<bool>(dict.at("Scale" ), *this)); |
2651 | |
2652 | bool Sparse; |
2653 | ASSIGN_VALUE_OR_RETURN_ERR(Sparse, loadAttribute<bool>(dict.at("Sparse" ), *this)); |
2654 | |
2655 | EmbeddingNode *loadedNode = G_->addNode(new EmbeddingNode(opName, ResultOutTy, Weights, Indices, PadIdx, Scale, Sparse)); |
2656 | |
2657 | if (dict.count("Predicate" )) { |
2658 | NodeValue Predicate; |
2659 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2660 | loadedNode->setPredicate(Predicate); |
2661 | } |
2662 | |
2663 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2664 | return loadedNode; |
2665 | } |
2666 | |
2667 | if (typeName == "Glow_EmbeddingBag" ) { |
2668 | NodeValue Data; |
2669 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2670 | |
2671 | NodeValue Weights; |
2672 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
2673 | |
2674 | NodeValue Indices; |
2675 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(2))); |
2676 | |
2677 | NodeValue Offsets; |
2678 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(3))); |
2679 | |
2680 | TypeRef ResultOutTy; |
2681 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2682 | |
2683 | bool HasEndOffset; |
2684 | ASSIGN_VALUE_OR_RETURN_ERR(HasEndOffset, loadAttribute<bool>(dict.at("HasEndOffset" ), *this)); |
2685 | |
2686 | glow::LengthsMode LengthsMode; |
2687 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2688 | |
2689 | float AvgLength; |
2690 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2691 | |
2692 | EmbeddingBagNode *loadedNode = G_->addNode(new EmbeddingBagNode(opName, ResultOutTy, Data, Weights, Indices, Offsets, HasEndOffset, LengthsMode, AvgLength)); |
2693 | |
2694 | if (dict.count("Predicate" )) { |
2695 | NodeValue Predicate; |
2696 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2697 | loadedNode->setPredicate(Predicate); |
2698 | } |
2699 | |
2700 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2701 | return loadedNode; |
2702 | } |
2703 | |
2704 | if (typeName == "Glow_EmbeddingBagByteRowwiseOffsets" ) { |
2705 | NodeValue Data; |
2706 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2707 | |
2708 | NodeValue Weights; |
2709 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
2710 | |
2711 | NodeValue Indices; |
2712 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(2))); |
2713 | |
2714 | NodeValue Offsets; |
2715 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(3))); |
2716 | |
2717 | TypeRef ResultOutTy; |
2718 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2719 | |
2720 | bool UseFP16Accumulation; |
2721 | ASSIGN_VALUE_OR_RETURN_ERR(UseFP16Accumulation, loadAttribute<bool>(dict.at("UseFP16Accumulation" ), *this)); |
2722 | |
2723 | bool HasEndOffset; |
2724 | ASSIGN_VALUE_OR_RETURN_ERR(HasEndOffset, loadAttribute<bool>(dict.at("HasEndOffset" ), *this)); |
2725 | |
2726 | glow::LengthsMode LengthsMode; |
2727 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2728 | |
2729 | float AvgLength; |
2730 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2731 | |
2732 | EmbeddingBagByteRowwiseOffsetsNode *loadedNode = G_->addNode(new EmbeddingBagByteRowwiseOffsetsNode(opName, ResultOutTy, Data, Weights, Indices, Offsets, UseFP16Accumulation, HasEndOffset, LengthsMode, AvgLength)); |
2733 | |
2734 | if (dict.count("Predicate" )) { |
2735 | NodeValue Predicate; |
2736 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2737 | loadedNode->setPredicate(Predicate); |
2738 | } |
2739 | |
2740 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2741 | return loadedNode; |
2742 | } |
2743 | |
2744 | if (typeName == "Glow_RowwiseQuantizedSparseLengthsWeightedSum" ) { |
2745 | NodeValue Data; |
2746 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2747 | |
2748 | NodeValue Scales; |
2749 | ASSIGN_VALUE_OR_RETURN_ERR(Scales, getNodeValueByName(op.input(1))); |
2750 | |
2751 | NodeValue Offsets; |
2752 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(2))); |
2753 | |
2754 | NodeValue Weights; |
2755 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(3))); |
2756 | |
2757 | NodeValue Indices; |
2758 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(4))); |
2759 | |
2760 | NodeValue Lengths; |
2761 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(5))); |
2762 | |
2763 | TypeRef ResultOutTy; |
2764 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2765 | |
2766 | bool UseFP16Accumulation; |
2767 | ASSIGN_VALUE_OR_RETURN_ERR(UseFP16Accumulation, loadAttribute<bool>(dict.at("UseFP16Accumulation" ), *this)); |
2768 | |
2769 | glow::LengthsMode LengthsMode; |
2770 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2771 | |
2772 | float AvgLength; |
2773 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2774 | |
2775 | RowwiseQuantizedSparseLengthsWeightedSumNode *loadedNode = G_->addNode(new RowwiseQuantizedSparseLengthsWeightedSumNode(opName, ResultOutTy, Data, Scales, Offsets, Weights, Indices, Lengths, UseFP16Accumulation, LengthsMode, AvgLength)); |
2776 | |
2777 | if (dict.count("Predicate" )) { |
2778 | NodeValue Predicate; |
2779 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2780 | loadedNode->setPredicate(Predicate); |
2781 | } |
2782 | |
2783 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2784 | return loadedNode; |
2785 | } |
2786 | |
2787 | if (typeName == "Glow_FusedRowwiseQuantizedSparseLengthsWeightedSum" ) { |
2788 | NodeValue Data; |
2789 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2790 | |
2791 | NodeValue Weights; |
2792 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(1))); |
2793 | |
2794 | NodeValue Indices; |
2795 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(2))); |
2796 | |
2797 | NodeValue Lengths; |
2798 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(3))); |
2799 | |
2800 | TypeRef ResultOutTy; |
2801 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2802 | |
2803 | bool UseFP16Accumulation; |
2804 | ASSIGN_VALUE_OR_RETURN_ERR(UseFP16Accumulation, loadAttribute<bool>(dict.at("UseFP16Accumulation" ), *this)); |
2805 | |
2806 | glow::LengthsMode LengthsMode; |
2807 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2808 | |
2809 | float AvgLength; |
2810 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2811 | |
2812 | FusedRowwiseQuantizedSparseLengthsWeightedSumNode *loadedNode = G_->addNode(new FusedRowwiseQuantizedSparseLengthsWeightedSumNode(opName, ResultOutTy, Data, Weights, Indices, Lengths, UseFP16Accumulation, LengthsMode, AvgLength)); |
2813 | |
2814 | if (dict.count("Predicate" )) { |
2815 | NodeValue Predicate; |
2816 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2817 | loadedNode->setPredicate(Predicate); |
2818 | } |
2819 | |
2820 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2821 | return loadedNode; |
2822 | } |
2823 | |
2824 | if (typeName == "Glow_FusedRowwiseQuantizedSparseLengthsSum" ) { |
2825 | NodeValue Data; |
2826 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2827 | |
2828 | NodeValue Indices; |
2829 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
2830 | |
2831 | NodeValue Lengths; |
2832 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(2))); |
2833 | |
2834 | TypeRef ResultOutTy; |
2835 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2836 | |
2837 | bool UseFP16Accumulation; |
2838 | ASSIGN_VALUE_OR_RETURN_ERR(UseFP16Accumulation, loadAttribute<bool>(dict.at("UseFP16Accumulation" ), *this)); |
2839 | |
2840 | glow::LengthsMode LengthsMode; |
2841 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsMode, loadAttribute<glow::LengthsMode>(dict.at("LengthsMode" ), *this)); |
2842 | |
2843 | float AvgLength; |
2844 | ASSIGN_VALUE_OR_RETURN_ERR(AvgLength, loadAttribute<float>(dict.at("AvgLength" ), *this)); |
2845 | |
2846 | FusedRowwiseQuantizedSparseLengthsSumNode *loadedNode = G_->addNode(new FusedRowwiseQuantizedSparseLengthsSumNode(opName, ResultOutTy, Data, Indices, Lengths, UseFP16Accumulation, LengthsMode, AvgLength)); |
2847 | |
2848 | if (dict.count("Predicate" )) { |
2849 | NodeValue Predicate; |
2850 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2851 | loadedNode->setPredicate(Predicate); |
2852 | } |
2853 | |
2854 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2855 | return loadedNode; |
2856 | } |
2857 | |
2858 | if (typeName == "Glow_LengthsToRanges" ) { |
2859 | NodeValue Lengths; |
2860 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(0))); |
2861 | |
2862 | TypeRef ResultOutTy; |
2863 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2864 | |
2865 | LengthsToRangesNode *loadedNode = G_->addNode(new LengthsToRangesNode(opName, ResultOutTy, Lengths)); |
2866 | |
2867 | if (dict.count("Predicate" )) { |
2868 | NodeValue Predicate; |
2869 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2870 | loadedNode->setPredicate(Predicate); |
2871 | } |
2872 | |
2873 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2874 | return loadedNode; |
2875 | } |
2876 | |
2877 | if (typeName == "Glow_LengthsRangeFill" ) { |
2878 | NodeValue Lengths; |
2879 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(0))); |
2880 | |
2881 | TypeRef ResultOutTy; |
2882 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2883 | |
2884 | LengthsRangeFillNode *loadedNode = G_->addNode(new LengthsRangeFillNode(opName, ResultOutTy, Lengths)); |
2885 | |
2886 | if (dict.count("Predicate" )) { |
2887 | NodeValue Predicate; |
2888 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2889 | loadedNode->setPredicate(Predicate); |
2890 | } |
2891 | |
2892 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2893 | return loadedNode; |
2894 | } |
2895 | |
2896 | if (typeName == "Glow_BatchSparseToDense" ) { |
2897 | NodeValue Lengths; |
2898 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(0))); |
2899 | |
2900 | NodeValue Indices; |
2901 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
2902 | |
2903 | NodeValue Values; |
2904 | ASSIGN_VALUE_OR_RETURN_ERR(Values, getNodeValueByName(op.input(2))); |
2905 | |
2906 | TypeRef ResultOutTy; |
2907 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2908 | |
2909 | float DefaultValue; |
2910 | ASSIGN_VALUE_OR_RETURN_ERR(DefaultValue, loadAttribute<float>(dict.at("DefaultValue" ), *this)); |
2911 | |
2912 | unsigned_t DenseLastDim; |
2913 | ASSIGN_VALUE_OR_RETURN_ERR(DenseLastDim, loadAttribute<unsigned_t>(dict.at("DenseLastDim" ), *this)); |
2914 | |
2915 | BatchSparseToDenseNode *loadedNode = G_->addNode(new BatchSparseToDenseNode(opName, ResultOutTy, Lengths, Indices, Values, DefaultValue, DenseLastDim)); |
2916 | |
2917 | if (dict.count("Predicate" )) { |
2918 | NodeValue Predicate; |
2919 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2920 | loadedNode->setPredicate(Predicate); |
2921 | } |
2922 | |
2923 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2924 | return loadedNode; |
2925 | } |
2926 | |
2927 | if (typeName == "Glow_FillExamplesWithIndicator" ) { |
2928 | NodeValue Data; |
2929 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
2930 | |
2931 | NodeValue Indicator; |
2932 | ASSIGN_VALUE_OR_RETURN_ERR(Indicator, getNodeValueByName(op.input(1))); |
2933 | |
2934 | TypeRef ResultOutTy; |
2935 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2936 | |
2937 | FillExamplesWithIndicatorNode *loadedNode = G_->addNode(new FillExamplesWithIndicatorNode(opName, ResultOutTy, Data, Indicator)); |
2938 | |
2939 | if (dict.count("Predicate" )) { |
2940 | NodeValue Predicate; |
2941 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2942 | loadedNode->setPredicate(Predicate); |
2943 | } |
2944 | |
2945 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2946 | return loadedNode; |
2947 | } |
2948 | |
2949 | if (typeName == "Glow_SparseToDenseMask" ) { |
2950 | NodeValue Indices; |
2951 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(0))); |
2952 | |
2953 | NodeValue Values; |
2954 | ASSIGN_VALUE_OR_RETURN_ERR(Values, getNodeValueByName(op.input(1))); |
2955 | |
2956 | NodeValue DefaultValue; |
2957 | ASSIGN_VALUE_OR_RETURN_ERR(DefaultValue, getNodeValueByName(op.input(2))); |
2958 | |
2959 | NodeValue Lengths; |
2960 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(3))); |
2961 | |
2962 | TypeRef ResultOutTy; |
2963 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2964 | |
2965 | std::vector<dim_t> Mask; |
2966 | ASSIGN_VALUE_OR_RETURN_ERR(Mask, loadAttribute<std::vector<dim_t>>(dict.at("Mask" ), *this)); |
2967 | |
2968 | SparseToDenseMaskNode *loadedNode = G_->addNode(new SparseToDenseMaskNode(opName, ResultOutTy, Indices, Values, DefaultValue, Lengths, Mask)); |
2969 | |
2970 | if (dict.count("Predicate" )) { |
2971 | NodeValue Predicate; |
2972 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2973 | loadedNode->setPredicate(Predicate); |
2974 | } |
2975 | |
2976 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2977 | return loadedNode; |
2978 | } |
2979 | |
2980 | if (typeName == "Glow_IsNaN" ) { |
2981 | NodeValue Input; |
2982 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
2983 | |
2984 | TypeRef ResultOutTy; |
2985 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
2986 | |
2987 | IsNaNNode *loadedNode = G_->addNode(new IsNaNNode(opName, ResultOutTy, Input)); |
2988 | |
2989 | if (dict.count("Predicate" )) { |
2990 | NodeValue Predicate; |
2991 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
2992 | loadedNode->setPredicate(Predicate); |
2993 | } |
2994 | |
2995 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
2996 | return loadedNode; |
2997 | } |
2998 | |
2999 | if (typeName == "Glow_ReplaceNaN" ) { |
3000 | NodeValue Input; |
3001 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3002 | |
3003 | TypeRef ResultOutTy; |
3004 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3005 | |
3006 | float Value; |
3007 | ASSIGN_VALUE_OR_RETURN_ERR(Value, loadAttribute<float>(dict.at("Value" ), *this)); |
3008 | |
3009 | ReplaceNaNNode *loadedNode = G_->addNode(new ReplaceNaNNode(opName, ResultOutTy, Input, Value)); |
3010 | |
3011 | if (dict.count("Predicate" )) { |
3012 | NodeValue Predicate; |
3013 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3014 | loadedNode->setPredicate(Predicate); |
3015 | } |
3016 | |
3017 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3018 | return loadedNode; |
3019 | } |
3020 | |
3021 | if (typeName == "Glow_Modulo" ) { |
3022 | NodeValue Input; |
3023 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3024 | |
3025 | TypeRef ResultOutTy; |
3026 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3027 | |
3028 | int64_t Divisor; |
3029 | ASSIGN_VALUE_OR_RETURN_ERR(Divisor, loadAttribute<int64_t>(dict.at("Divisor" ), *this)); |
3030 | |
3031 | bool SignFollowDivisor; |
3032 | ASSIGN_VALUE_OR_RETURN_ERR(SignFollowDivisor, loadAttribute<bool>(dict.at("SignFollowDivisor" ), *this)); |
3033 | |
3034 | ModuloNode *loadedNode = G_->addNode(new ModuloNode(opName, ResultOutTy, Input, Divisor, SignFollowDivisor)); |
3035 | |
3036 | if (dict.count("Predicate" )) { |
3037 | NodeValue Predicate; |
3038 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3039 | loadedNode->setPredicate(Predicate); |
3040 | } |
3041 | |
3042 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3043 | return loadedNode; |
3044 | } |
3045 | |
3046 | if (typeName == "Glow_BatchedPairwiseDotProduct" ) { |
3047 | TypeRef ResultOutTy; |
3048 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3049 | |
3050 | std::vector<NodeValue> Inputs; |
3051 | ASSIGN_VALUE_OR_RETURN_ERR(Inputs, loadAttribute<std::vector<NodeValue>>(dict.at("Inputs" ), *this)); |
3052 | |
3053 | BatchedPairwiseDotProductNode *loadedNode = G_->addNode(new BatchedPairwiseDotProductNode(opName, ResultOutTy, Inputs)); |
3054 | |
3055 | if (dict.count("Predicate" )) { |
3056 | NodeValue Predicate; |
3057 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3058 | loadedNode->setPredicate(Predicate); |
3059 | } |
3060 | |
3061 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3062 | return loadedNode; |
3063 | } |
3064 | |
3065 | if (typeName == "Glow_BatchedPairwiseDotProductGrad" ) { |
3066 | NodeValue OutputGrad; |
3067 | ASSIGN_VALUE_OR_RETURN_ERR(OutputGrad, getNodeValueByName(op.input(0))); |
3068 | |
3069 | std::vector<NodeValue> OriginalInputs; |
3070 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalInputs, loadAttribute<std::vector<NodeValue>>(dict.at("OriginalInputs" ), *this)); |
3071 | |
3072 | BatchedPairwiseDotProductGradNode *loadedNode = G_->addNode(new BatchedPairwiseDotProductGradNode(opName, OutputGrad, OriginalInputs)); |
3073 | |
3074 | if (dict.count("Predicate" )) { |
3075 | NodeValue Predicate; |
3076 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3077 | loadedNode->setPredicate(Predicate); |
3078 | } |
3079 | |
3080 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3081 | return loadedNode; |
3082 | } |
3083 | |
3084 | if (typeName == "Glow_BatchedUnaryEmbeddingsBags" ) { |
3085 | NodeValue Weights; |
3086 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, getNodeValueByName(op.input(0))); |
3087 | |
3088 | NodeValue TableOffsets; |
3089 | ASSIGN_VALUE_OR_RETURN_ERR(TableOffsets, getNodeValueByName(op.input(1))); |
3090 | |
3091 | NodeValue Offsets; |
3092 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(2))); |
3093 | |
3094 | NodeValue Indices; |
3095 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(3))); |
3096 | |
3097 | TypeRef ResultOutTy; |
3098 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3099 | |
3100 | BatchedUnaryEmbeddingsBagsNode *loadedNode = G_->addNode(new BatchedUnaryEmbeddingsBagsNode(opName, ResultOutTy, Weights, TableOffsets, Offsets, Indices)); |
3101 | |
3102 | if (dict.count("Predicate" )) { |
3103 | NodeValue Predicate; |
3104 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3105 | loadedNode->setPredicate(Predicate); |
3106 | } |
3107 | |
3108 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3109 | return loadedNode; |
3110 | } |
3111 | |
3112 | if (typeName == "Glow_IntNBitSplitEmbeddingBags" ) { |
3113 | NodeValue DevWeights; |
3114 | ASSIGN_VALUE_OR_RETURN_ERR(DevWeights, getNodeValueByName(op.input(0))); |
3115 | |
3116 | NodeValue UvmWeights; |
3117 | ASSIGN_VALUE_OR_RETURN_ERR(UvmWeights, getNodeValueByName(op.input(1))); |
3118 | |
3119 | NodeValue WeightsPlacements; |
3120 | ASSIGN_VALUE_OR_RETURN_ERR(WeightsPlacements, getNodeValueByName(op.input(2))); |
3121 | |
3122 | NodeValue WeightsOffsets; |
3123 | ASSIGN_VALUE_OR_RETURN_ERR(WeightsOffsets, getNodeValueByName(op.input(3))); |
3124 | |
3125 | NodeValue WeightsTys; |
3126 | ASSIGN_VALUE_OR_RETURN_ERR(WeightsTys, getNodeValueByName(op.input(4))); |
3127 | |
3128 | NodeValue DimOffsets; |
3129 | ASSIGN_VALUE_OR_RETURN_ERR(DimOffsets, getNodeValueByName(op.input(5))); |
3130 | |
3131 | NodeValue Indices; |
3132 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(6))); |
3133 | |
3134 | NodeValue Offsets; |
3135 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(7))); |
3136 | |
3137 | TypeRef ResultOutTy; |
3138 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3139 | |
3140 | int64_t TotalDims; |
3141 | ASSIGN_VALUE_OR_RETURN_ERR(TotalDims, loadAttribute<int64_t>(dict.at("TotalDims" ), *this)); |
3142 | |
3143 | glow::SplitEmbeddingPoolingMode PoolingMode; |
3144 | ASSIGN_VALUE_OR_RETURN_ERR(PoolingMode, loadAttribute<glow::SplitEmbeddingPoolingMode>(dict.at("PoolingMode" ), *this)); |
3145 | |
3146 | glow::SplitEmbeddingSparseType OutputDType; |
3147 | ASSIGN_VALUE_OR_RETURN_ERR(OutputDType, loadAttribute<glow::SplitEmbeddingSparseType>(dict.at("OutputDType" ), *this)); |
3148 | |
3149 | IntNBitSplitEmbeddingBagsNode *loadedNode = G_->addNode(new IntNBitSplitEmbeddingBagsNode(opName, ResultOutTy, DevWeights, UvmWeights, WeightsPlacements, WeightsOffsets, WeightsTys, DimOffsets, Indices, Offsets, TotalDims, PoolingMode, OutputDType)); |
3150 | |
3151 | if (dict.count("Predicate" )) { |
3152 | NodeValue Predicate; |
3153 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3154 | loadedNode->setPredicate(Predicate); |
3155 | } |
3156 | |
3157 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3158 | return loadedNode; |
3159 | } |
3160 | |
3161 | if (typeName == "Glow_IntNBitSplitEmbeddingWeightedBags" ) { |
3162 | NodeValue DevWeights; |
3163 | ASSIGN_VALUE_OR_RETURN_ERR(DevWeights, getNodeValueByName(op.input(0))); |
3164 | |
3165 | NodeValue UvmWeights; |
3166 | ASSIGN_VALUE_OR_RETURN_ERR(UvmWeights, getNodeValueByName(op.input(1))); |
3167 | |
3168 | NodeValue WeightsPlacements; |
3169 | ASSIGN_VALUE_OR_RETURN_ERR(WeightsPlacements, getNodeValueByName(op.input(2))); |
3170 | |
3171 | NodeValue WeightsOffsets; |
3172 | ASSIGN_VALUE_OR_RETURN_ERR(WeightsOffsets, getNodeValueByName(op.input(3))); |
3173 | |
3174 | NodeValue WeightsTys; |
3175 | ASSIGN_VALUE_OR_RETURN_ERR(WeightsTys, getNodeValueByName(op.input(4))); |
3176 | |
3177 | NodeValue DimOffsets; |
3178 | ASSIGN_VALUE_OR_RETURN_ERR(DimOffsets, getNodeValueByName(op.input(5))); |
3179 | |
3180 | NodeValue Indices; |
3181 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(6))); |
3182 | |
3183 | NodeValue Offsets; |
3184 | ASSIGN_VALUE_OR_RETURN_ERR(Offsets, getNodeValueByName(op.input(7))); |
3185 | |
3186 | NodeValue IndiceWeight; |
3187 | ASSIGN_VALUE_OR_RETURN_ERR(IndiceWeight, getNodeValueByName(op.input(8))); |
3188 | |
3189 | TypeRef ResultOutTy; |
3190 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3191 | |
3192 | int64_t TotalDims; |
3193 | ASSIGN_VALUE_OR_RETURN_ERR(TotalDims, loadAttribute<int64_t>(dict.at("TotalDims" ), *this)); |
3194 | |
3195 | glow::SplitEmbeddingPoolingMode PoolingMode; |
3196 | ASSIGN_VALUE_OR_RETURN_ERR(PoolingMode, loadAttribute<glow::SplitEmbeddingPoolingMode>(dict.at("PoolingMode" ), *this)); |
3197 | |
3198 | glow::SplitEmbeddingSparseType OutputDType; |
3199 | ASSIGN_VALUE_OR_RETURN_ERR(OutputDType, loadAttribute<glow::SplitEmbeddingSparseType>(dict.at("OutputDType" ), *this)); |
3200 | |
3201 | IntNBitSplitEmbeddingWeightedBagsNode *loadedNode = G_->addNode(new IntNBitSplitEmbeddingWeightedBagsNode(opName, ResultOutTy, DevWeights, UvmWeights, WeightsPlacements, WeightsOffsets, WeightsTys, DimOffsets, Indices, Offsets, IndiceWeight, TotalDims, PoolingMode, OutputDType)); |
3202 | |
3203 | if (dict.count("Predicate" )) { |
3204 | NodeValue Predicate; |
3205 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3206 | loadedNode->setPredicate(Predicate); |
3207 | } |
3208 | |
3209 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3210 | return loadedNode; |
3211 | } |
3212 | |
3213 | if (typeName == "Glow_GaussianFill" ) { |
3214 | NodeValue Input; |
3215 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3216 | |
3217 | TypeRef ResultOutTy; |
3218 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3219 | |
3220 | float Mean; |
3221 | ASSIGN_VALUE_OR_RETURN_ERR(Mean, loadAttribute<float>(dict.at("Mean" ), *this)); |
3222 | |
3223 | float Scale; |
3224 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, loadAttribute<float>(dict.at("Scale" ), *this)); |
3225 | |
3226 | float Seed; |
3227 | ASSIGN_VALUE_OR_RETURN_ERR(Seed, loadAttribute<float>(dict.at("Seed" ), *this)); |
3228 | |
3229 | GaussianFillNode *loadedNode = G_->addNode(new GaussianFillNode(opName, ResultOutTy, Input, Mean, Scale, Seed)); |
3230 | |
3231 | if (dict.count("Predicate" )) { |
3232 | NodeValue Predicate; |
3233 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3234 | loadedNode->setPredicate(Predicate); |
3235 | } |
3236 | |
3237 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3238 | return loadedNode; |
3239 | } |
3240 | |
3241 | if (typeName == "Glow_ReluGrad" ) { |
3242 | NodeValue Input; |
3243 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3244 | |
3245 | NodeValue OriginalOutputForResult; |
3246 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
3247 | |
3248 | NodeValue GradOfOriginalOutputNamedResult; |
3249 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
3250 | |
3251 | ReluGradNode *loadedNode = G_->addNode(new ReluGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
3252 | |
3253 | if (dict.count("Predicate" )) { |
3254 | NodeValue Predicate; |
3255 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3256 | loadedNode->setPredicate(Predicate); |
3257 | } |
3258 | |
3259 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3260 | return loadedNode; |
3261 | } |
3262 | |
3263 | if (typeName == "Glow_Relu" ) { |
3264 | NodeValue Input; |
3265 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3266 | |
3267 | TypeRef ResultOutTy; |
3268 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3269 | |
3270 | ReluNode *loadedNode = G_->addNode(new ReluNode(opName, ResultOutTy, Input)); |
3271 | |
3272 | if (dict.count("Predicate" )) { |
3273 | NodeValue Predicate; |
3274 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3275 | loadedNode->setPredicate(Predicate); |
3276 | } |
3277 | |
3278 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3279 | return loadedNode; |
3280 | } |
3281 | |
3282 | if (typeName == "Glow_HardSwish" ) { |
3283 | NodeValue Input; |
3284 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3285 | |
3286 | TypeRef ResultOutTy; |
3287 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3288 | |
3289 | HardSwishNode *loadedNode = G_->addNode(new HardSwishNode(opName, ResultOutTy, Input)); |
3290 | |
3291 | if (dict.count("Predicate" )) { |
3292 | NodeValue Predicate; |
3293 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3294 | loadedNode->setPredicate(Predicate); |
3295 | } |
3296 | |
3297 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3298 | return loadedNode; |
3299 | } |
3300 | |
3301 | if (typeName == "Glow_Gelu" ) { |
3302 | NodeValue Input; |
3303 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3304 | |
3305 | TypeRef ResultOutTy; |
3306 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3307 | |
3308 | GeluNode *loadedNode = G_->addNode(new GeluNode(opName, ResultOutTy, Input)); |
3309 | |
3310 | if (dict.count("Predicate" )) { |
3311 | NodeValue Predicate; |
3312 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3313 | loadedNode->setPredicate(Predicate); |
3314 | } |
3315 | |
3316 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3317 | return loadedNode; |
3318 | } |
3319 | |
3320 | if (typeName == "Glow_Clip" ) { |
3321 | NodeValue Input; |
3322 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3323 | |
3324 | TypeRef ResultOutTy; |
3325 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3326 | |
3327 | float Min; |
3328 | ASSIGN_VALUE_OR_RETURN_ERR(Min, loadAttribute<float>(dict.at("Min" ), *this)); |
3329 | |
3330 | float Max; |
3331 | ASSIGN_VALUE_OR_RETURN_ERR(Max, loadAttribute<float>(dict.at("Max" ), *this)); |
3332 | |
3333 | ClipNode *loadedNode = G_->addNode(new ClipNode(opName, ResultOutTy, Input, Min, Max)); |
3334 | |
3335 | if (dict.count("Predicate" )) { |
3336 | NodeValue Predicate; |
3337 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3338 | loadedNode->setPredicate(Predicate); |
3339 | } |
3340 | |
3341 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3342 | return loadedNode; |
3343 | } |
3344 | |
3345 | if (typeName == "Glow_PRelu" ) { |
3346 | NodeValue Input; |
3347 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3348 | |
3349 | NodeValue Slope; |
3350 | ASSIGN_VALUE_OR_RETURN_ERR(Slope, getNodeValueByName(op.input(1))); |
3351 | |
3352 | TypeRef ResultOutTy; |
3353 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3354 | |
3355 | PReluNode *loadedNode = G_->addNode(new PReluNode(opName, ResultOutTy, Input, Slope)); |
3356 | |
3357 | if (dict.count("Predicate" )) { |
3358 | NodeValue Predicate; |
3359 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3360 | loadedNode->setPredicate(Predicate); |
3361 | } |
3362 | |
3363 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3364 | return loadedNode; |
3365 | } |
3366 | |
3367 | if (typeName == "Glow_SigmoidGrad" ) { |
3368 | NodeValue Input; |
3369 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3370 | |
3371 | NodeValue OriginalOutputForResult; |
3372 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
3373 | |
3374 | NodeValue GradOfOriginalOutputNamedResult; |
3375 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
3376 | |
3377 | SigmoidGradNode *loadedNode = G_->addNode(new SigmoidGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
3378 | |
3379 | if (dict.count("Predicate" )) { |
3380 | NodeValue Predicate; |
3381 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3382 | loadedNode->setPredicate(Predicate); |
3383 | } |
3384 | |
3385 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3386 | return loadedNode; |
3387 | } |
3388 | |
3389 | if (typeName == "Glow_Sigmoid" ) { |
3390 | NodeValue Input; |
3391 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3392 | |
3393 | TypeRef ResultOutTy; |
3394 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3395 | |
3396 | SigmoidNode *loadedNode = G_->addNode(new SigmoidNode(opName, ResultOutTy, Input)); |
3397 | |
3398 | if (dict.count("Predicate" )) { |
3399 | NodeValue Predicate; |
3400 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3401 | loadedNode->setPredicate(Predicate); |
3402 | } |
3403 | |
3404 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3405 | return loadedNode; |
3406 | } |
3407 | |
3408 | if (typeName == "Glow_Swish" ) { |
3409 | NodeValue Input; |
3410 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3411 | |
3412 | TypeRef ResultOutTy; |
3413 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3414 | |
3415 | SwishNode *loadedNode = G_->addNode(new SwishNode(opName, ResultOutTy, Input)); |
3416 | |
3417 | if (dict.count("Predicate" )) { |
3418 | NodeValue Predicate; |
3419 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3420 | loadedNode->setPredicate(Predicate); |
3421 | } |
3422 | |
3423 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3424 | return loadedNode; |
3425 | } |
3426 | |
3427 | if (typeName == "Glow_TanhGrad" ) { |
3428 | NodeValue Input; |
3429 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3430 | |
3431 | NodeValue OriginalOutputForResult; |
3432 | ASSIGN_VALUE_OR_RETURN_ERR(OriginalOutputForResult, getNodeValueByName(op.input(1))); |
3433 | |
3434 | NodeValue GradOfOriginalOutputNamedResult; |
3435 | ASSIGN_VALUE_OR_RETURN_ERR(GradOfOriginalOutputNamedResult, getNodeValueByName(op.input(2))); |
3436 | |
3437 | TanhGradNode *loadedNode = G_->addNode(new TanhGradNode(opName, Input, OriginalOutputForResult, GradOfOriginalOutputNamedResult)); |
3438 | |
3439 | if (dict.count("Predicate" )) { |
3440 | NodeValue Predicate; |
3441 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3442 | loadedNode->setPredicate(Predicate); |
3443 | } |
3444 | |
3445 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3446 | return loadedNode; |
3447 | } |
3448 | |
3449 | if (typeName == "Glow_Tanh" ) { |
3450 | NodeValue Input; |
3451 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3452 | |
3453 | TypeRef ResultOutTy; |
3454 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3455 | |
3456 | TanhNode *loadedNode = G_->addNode(new TanhNode(opName, ResultOutTy, Input)); |
3457 | |
3458 | if (dict.count("Predicate" )) { |
3459 | NodeValue Predicate; |
3460 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3461 | loadedNode->setPredicate(Predicate); |
3462 | } |
3463 | |
3464 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3465 | return loadedNode; |
3466 | } |
3467 | |
3468 | if (typeName == "Glow_LeakyRelu" ) { |
3469 | NodeValue Input; |
3470 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3471 | |
3472 | TypeRef ResultOutTy; |
3473 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3474 | |
3475 | float Alpha; |
3476 | ASSIGN_VALUE_OR_RETURN_ERR(Alpha, loadAttribute<float>(dict.at("Alpha" ), *this)); |
3477 | |
3478 | LeakyReluNode *loadedNode = G_->addNode(new LeakyReluNode(opName, ResultOutTy, Input, Alpha)); |
3479 | |
3480 | if (dict.count("Predicate" )) { |
3481 | NodeValue Predicate; |
3482 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3483 | loadedNode->setPredicate(Predicate); |
3484 | } |
3485 | |
3486 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3487 | return loadedNode; |
3488 | } |
3489 | |
3490 | if (typeName == "Glow_SoftPlus" ) { |
3491 | NodeValue Input; |
3492 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3493 | |
3494 | TypeRef ResultOutTy; |
3495 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3496 | |
3497 | SoftPlusNode *loadedNode = G_->addNode(new SoftPlusNode(opName, ResultOutTy, Input)); |
3498 | |
3499 | if (dict.count("Predicate" )) { |
3500 | NodeValue Predicate; |
3501 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3502 | loadedNode->setPredicate(Predicate); |
3503 | } |
3504 | |
3505 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3506 | return loadedNode; |
3507 | } |
3508 | |
3509 | if (typeName == "Glow_Reshape" ) { |
3510 | NodeValue Input; |
3511 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3512 | |
3513 | TypeRef ResultOutTy; |
3514 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3515 | |
3516 | std::vector<dim_t> Dims; |
3517 | ASSIGN_VALUE_OR_RETURN_ERR(Dims, loadAttribute<std::vector<dim_t>>(dict.at("Dims" ), *this)); |
3518 | |
3519 | std::string Layout; |
3520 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<std::string>(dict.at("Layout" ), *this)); |
3521 | |
3522 | ReshapeNode *loadedNode = G_->addNode(new ReshapeNode(opName, ResultOutTy, Input, Dims, Layout)); |
3523 | |
3524 | if (dict.count("Predicate" )) { |
3525 | NodeValue Predicate; |
3526 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3527 | loadedNode->setPredicate(Predicate); |
3528 | } |
3529 | |
3530 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3531 | return loadedNode; |
3532 | } |
3533 | |
3534 | if (typeName == "Glow_Transpose" ) { |
3535 | NodeValue Input; |
3536 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3537 | |
3538 | TypeRef ResultOutTy; |
3539 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3540 | |
3541 | std::vector<unsigned_t> Shuffle; |
3542 | ASSIGN_VALUE_OR_RETURN_ERR(Shuffle, loadAttribute<std::vector<unsigned_t>>(dict.at("Shuffle" ), *this)); |
3543 | |
3544 | std::string Layout; |
3545 | ASSIGN_VALUE_OR_RETURN_ERR(Layout, loadAttribute<std::string>(dict.at("Layout" ), *this)); |
3546 | |
3547 | TransposeNode *loadedNode = G_->addNode(new TransposeNode(opName, ResultOutTy, Input, Shuffle, Layout)); |
3548 | |
3549 | if (dict.count("Predicate" )) { |
3550 | NodeValue Predicate; |
3551 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3552 | loadedNode->setPredicate(Predicate); |
3553 | } |
3554 | |
3555 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3556 | return loadedNode; |
3557 | } |
3558 | |
3559 | if (typeName == "Glow_Concat" ) { |
3560 | TypeRef ResultOutTy; |
3561 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3562 | |
3563 | std::vector<NodeValue> Inputs; |
3564 | ASSIGN_VALUE_OR_RETURN_ERR(Inputs, loadAttribute<std::vector<NodeValue>>(dict.at("Inputs" ), *this)); |
3565 | |
3566 | unsigned_t Dim; |
3567 | ASSIGN_VALUE_OR_RETURN_ERR(Dim, loadAttribute<unsigned_t>(dict.at("Dim" ), *this)); |
3568 | |
3569 | ConcatNode *loadedNode = G_->addNode(new ConcatNode(opName, ResultOutTy, Inputs, Dim)); |
3570 | |
3571 | if (dict.count("Predicate" )) { |
3572 | NodeValue Predicate; |
3573 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3574 | loadedNode->setPredicate(Predicate); |
3575 | } |
3576 | |
3577 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3578 | return loadedNode; |
3579 | } |
3580 | |
3581 | if (typeName == "Glow_Slice" ) { |
3582 | NodeValue Input; |
3583 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3584 | |
3585 | TypeRef ResultOutTy; |
3586 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3587 | |
3588 | std::vector<dim_t> Start; |
3589 | ASSIGN_VALUE_OR_RETURN_ERR(Start, loadAttribute<std::vector<dim_t>>(dict.at("Start" ), *this)); |
3590 | |
3591 | SliceNode *loadedNode = G_->addNode(new SliceNode(opName, ResultOutTy, Input, Start)); |
3592 | |
3593 | if (dict.count("Predicate" )) { |
3594 | NodeValue Predicate; |
3595 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3596 | loadedNode->setPredicate(Predicate); |
3597 | } |
3598 | |
3599 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3600 | return loadedNode; |
3601 | } |
3602 | |
3603 | if (typeName == "Glow_InsertTensor" ) { |
3604 | NodeValue Big; |
3605 | ASSIGN_VALUE_OR_RETURN_ERR(Big, getNodeValueByName(op.input(0))); |
3606 | |
3607 | NodeValue Small; |
3608 | ASSIGN_VALUE_OR_RETURN_ERR(Small, getNodeValueByName(op.input(1))); |
3609 | |
3610 | std::vector<dim_t> Start; |
3611 | ASSIGN_VALUE_OR_RETURN_ERR(Start, loadAttribute<std::vector<dim_t>>(dict.at("Start" ), *this)); |
3612 | |
3613 | unsigned_t Count; |
3614 | ASSIGN_VALUE_OR_RETURN_ERR(Count, loadAttribute<unsigned_t>(dict.at("Count" ), *this)); |
3615 | |
3616 | unsigned_t Axis; |
3617 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
3618 | |
3619 | InsertTensorNode *loadedNode = G_->addNode(new InsertTensorNode(opName, Big, Small, Start, Count, Axis)); |
3620 | |
3621 | if (dict.count("Predicate" )) { |
3622 | NodeValue Predicate; |
3623 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3624 | loadedNode->setPredicate(Predicate); |
3625 | } |
3626 | |
3627 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3628 | return loadedNode; |
3629 | } |
3630 | |
3631 | if (typeName == "Glow_Gather" ) { |
3632 | NodeValue Data; |
3633 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
3634 | |
3635 | NodeValue Indices; |
3636 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
3637 | |
3638 | TypeRef ResultOutTy; |
3639 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3640 | |
3641 | unsigned_t BatchDims; |
3642 | ASSIGN_VALUE_OR_RETURN_ERR(BatchDims, loadAttribute<unsigned_t>(dict.at("BatchDims" ), *this)); |
3643 | |
3644 | GatherNode *loadedNode = G_->addNode(new GatherNode(opName, ResultOutTy, Data, Indices, BatchDims)); |
3645 | |
3646 | if (dict.count("Predicate" )) { |
3647 | NodeValue Predicate; |
3648 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3649 | loadedNode->setPredicate(Predicate); |
3650 | } |
3651 | |
3652 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3653 | return loadedNode; |
3654 | } |
3655 | |
3656 | if (typeName == "Glow_GatherND" ) { |
3657 | NodeValue Data; |
3658 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
3659 | |
3660 | NodeValue Indices; |
3661 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
3662 | |
3663 | TypeRef ResultOutTy; |
3664 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3665 | |
3666 | unsigned_t BatchDims; |
3667 | ASSIGN_VALUE_OR_RETURN_ERR(BatchDims, loadAttribute<unsigned_t>(dict.at("BatchDims" ), *this)); |
3668 | |
3669 | GatherNDNode *loadedNode = G_->addNode(new GatherNDNode(opName, ResultOutTy, Data, Indices, BatchDims)); |
3670 | |
3671 | if (dict.count("Predicate" )) { |
3672 | NodeValue Predicate; |
3673 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3674 | loadedNode->setPredicate(Predicate); |
3675 | } |
3676 | |
3677 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3678 | return loadedNode; |
3679 | } |
3680 | |
3681 | if (typeName == "Glow_GatherElements" ) { |
3682 | NodeValue Data; |
3683 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
3684 | |
3685 | NodeValue Indices; |
3686 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
3687 | |
3688 | TypeRef ResultOutTy; |
3689 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3690 | |
3691 | unsigned_t Dim; |
3692 | ASSIGN_VALUE_OR_RETURN_ERR(Dim, loadAttribute<unsigned_t>(dict.at("Dim" ), *this)); |
3693 | |
3694 | GatherElementsNode *loadedNode = G_->addNode(new GatherElementsNode(opName, ResultOutTy, Data, Indices, Dim)); |
3695 | |
3696 | if (dict.count("Predicate" )) { |
3697 | NodeValue Predicate; |
3698 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3699 | loadedNode->setPredicate(Predicate); |
3700 | } |
3701 | |
3702 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3703 | return loadedNode; |
3704 | } |
3705 | |
3706 | if (typeName == "Glow_GatherRanges" ) { |
3707 | NodeValue Data; |
3708 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
3709 | |
3710 | NodeValue Ranges; |
3711 | ASSIGN_VALUE_OR_RETURN_ERR(Ranges, getNodeValueByName(op.input(1))); |
3712 | |
3713 | TypeRef OutputOutTy; |
3714 | ASSIGN_VALUE_OR_RETURN_ERR(OutputOutTy, loadTypeFromAttributes(0, dict)); |
3715 | |
3716 | TypeRef LengthsOutTy; |
3717 | ASSIGN_VALUE_OR_RETURN_ERR(LengthsOutTy, loadTypeFromAttributes(1, dict)); |
3718 | |
3719 | GatherRangesNode *loadedNode = G_->addNode(new GatherRangesNode(opName, OutputOutTy, LengthsOutTy, Data, Ranges)); |
3720 | |
3721 | if (dict.count("Predicate" )) { |
3722 | NodeValue Predicate; |
3723 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3724 | loadedNode->setPredicate(Predicate); |
3725 | } |
3726 | |
3727 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3728 | return loadedNode; |
3729 | } |
3730 | |
3731 | if (typeName == "Glow_ScatterData" ) { |
3732 | NodeValue Data; |
3733 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
3734 | |
3735 | NodeValue Indices; |
3736 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
3737 | |
3738 | NodeValue Slices; |
3739 | ASSIGN_VALUE_OR_RETURN_ERR(Slices, getNodeValueByName(op.input(2))); |
3740 | |
3741 | bool Cumulative; |
3742 | ASSIGN_VALUE_OR_RETURN_ERR(Cumulative, loadAttribute<bool>(dict.at("Cumulative" ), *this)); |
3743 | |
3744 | ScatterDataNode *loadedNode = G_->addNode(new ScatterDataNode(opName, Data, Indices, Slices, Cumulative)); |
3745 | |
3746 | if (dict.count("Predicate" )) { |
3747 | NodeValue Predicate; |
3748 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3749 | loadedNode->setPredicate(Predicate); |
3750 | } |
3751 | |
3752 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3753 | return loadedNode; |
3754 | } |
3755 | |
3756 | if (typeName == "Glow_Tile" ) { |
3757 | NodeValue Input; |
3758 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3759 | |
3760 | TypeRef ResultOutTy; |
3761 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3762 | |
3763 | unsigned_t Count; |
3764 | ASSIGN_VALUE_OR_RETURN_ERR(Count, loadAttribute<unsigned_t>(dict.at("Count" ), *this)); |
3765 | |
3766 | unsigned_t Axis; |
3767 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
3768 | |
3769 | TileNode *loadedNode = G_->addNode(new TileNode(opName, ResultOutTy, Input, Count, Axis)); |
3770 | |
3771 | if (dict.count("Predicate" )) { |
3772 | NodeValue Predicate; |
3773 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3774 | loadedNode->setPredicate(Predicate); |
3775 | } |
3776 | |
3777 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3778 | return loadedNode; |
3779 | } |
3780 | |
3781 | if (typeName == "Glow_BatchOneHot" ) { |
3782 | NodeValue Data; |
3783 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
3784 | |
3785 | NodeValue Lengths; |
3786 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(1))); |
3787 | |
3788 | NodeValue Values; |
3789 | ASSIGN_VALUE_OR_RETURN_ERR(Values, getNodeValueByName(op.input(2))); |
3790 | |
3791 | TypeRef ResultOutTy; |
3792 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3793 | |
3794 | BatchOneHotNode *loadedNode = G_->addNode(new BatchOneHotNode(opName, ResultOutTy, Data, Lengths, Values)); |
3795 | |
3796 | if (dict.count("Predicate" )) { |
3797 | NodeValue Predicate; |
3798 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3799 | loadedNode->setPredicate(Predicate); |
3800 | } |
3801 | |
3802 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3803 | return loadedNode; |
3804 | } |
3805 | |
3806 | if (typeName == "Glow_SpaceToDepth" ) { |
3807 | NodeValue Input; |
3808 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3809 | |
3810 | TypeRef ResultOutTy; |
3811 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3812 | |
3813 | unsigned_t BlockSize; |
3814 | ASSIGN_VALUE_OR_RETURN_ERR(BlockSize, loadAttribute<unsigned_t>(dict.at("BlockSize" ), *this)); |
3815 | |
3816 | SpaceToDepthNode *loadedNode = G_->addNode(new SpaceToDepthNode(opName, ResultOutTy, Input, BlockSize)); |
3817 | |
3818 | if (dict.count("Predicate" )) { |
3819 | NodeValue Predicate; |
3820 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3821 | loadedNode->setPredicate(Predicate); |
3822 | } |
3823 | |
3824 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3825 | return loadedNode; |
3826 | } |
3827 | |
3828 | if (typeName == "Glow_ResizeNearest" ) { |
3829 | NodeValue Input; |
3830 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3831 | |
3832 | TypeRef ResultOutTy; |
3833 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3834 | |
3835 | std::vector<float> Scale; |
3836 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, loadAttribute<std::vector<float>>(dict.at("Scale" ), *this)); |
3837 | |
3838 | ResizeNearestNode *loadedNode = G_->addNode(new ResizeNearestNode(opName, ResultOutTy, Input, Scale)); |
3839 | |
3840 | if (dict.count("Predicate" )) { |
3841 | NodeValue Predicate; |
3842 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3843 | loadedNode->setPredicate(Predicate); |
3844 | } |
3845 | |
3846 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3847 | return loadedNode; |
3848 | } |
3849 | |
3850 | if (typeName == "Glow_ResizeBilinear" ) { |
3851 | NodeValue Input; |
3852 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3853 | |
3854 | TypeRef ResultOutTy; |
3855 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3856 | |
3857 | std::vector<float> Scale; |
3858 | ASSIGN_VALUE_OR_RETURN_ERR(Scale, loadAttribute<std::vector<float>>(dict.at("Scale" ), *this)); |
3859 | |
3860 | ResizeBilinearNode *loadedNode = G_->addNode(new ResizeBilinearNode(opName, ResultOutTy, Input, Scale)); |
3861 | |
3862 | if (dict.count("Predicate" )) { |
3863 | NodeValue Predicate; |
3864 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3865 | loadedNode->setPredicate(Predicate); |
3866 | } |
3867 | |
3868 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3869 | return loadedNode; |
3870 | } |
3871 | |
3872 | if (typeName == "Glow_Broadcast" ) { |
3873 | NodeValue Input; |
3874 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3875 | |
3876 | TypeRef ResultOutTy; |
3877 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3878 | |
3879 | unsigned_t Axis; |
3880 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
3881 | |
3882 | std::vector<dim_t> TargetDim; |
3883 | ASSIGN_VALUE_OR_RETURN_ERR(TargetDim, loadAttribute<std::vector<dim_t>>(dict.at("TargetDim" ), *this)); |
3884 | |
3885 | BroadcastNode *loadedNode = G_->addNode(new BroadcastNode(opName, ResultOutTy, Input, Axis, TargetDim)); |
3886 | |
3887 | if (dict.count("Predicate" )) { |
3888 | NodeValue Predicate; |
3889 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3890 | loadedNode->setPredicate(Predicate); |
3891 | } |
3892 | |
3893 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3894 | return loadedNode; |
3895 | } |
3896 | |
3897 | if (typeName == "Glow_SparseLabelSplit" ) { |
3898 | NodeValue Lengths; |
3899 | ASSIGN_VALUE_OR_RETURN_ERR(Lengths, getNodeValueByName(op.input(0))); |
3900 | |
3901 | NodeValue Indices; |
3902 | ASSIGN_VALUE_OR_RETURN_ERR(Indices, getNodeValueByName(op.input(1))); |
3903 | |
3904 | NodeValue Values; |
3905 | ASSIGN_VALUE_OR_RETURN_ERR(Values, getNodeValueByName(op.input(2))); |
3906 | |
3907 | TypeRef LabelValuesOutTy; |
3908 | ASSIGN_VALUE_OR_RETURN_ERR(LabelValuesOutTy, loadTypeFromAttributes(0, dict)); |
3909 | |
3910 | TypeRef ExampleIdsOutTy; |
3911 | ASSIGN_VALUE_OR_RETURN_ERR(ExampleIdsOutTy, loadTypeFromAttributes(1, dict)); |
3912 | |
3913 | TypeRef GradientOffsetMapOutTy; |
3914 | ASSIGN_VALUE_OR_RETURN_ERR(GradientOffsetMapOutTy, loadTypeFromAttributes(2, dict)); |
3915 | |
3916 | unsigned_t NumLabels; |
3917 | ASSIGN_VALUE_OR_RETURN_ERR(NumLabels, loadAttribute<unsigned_t>(dict.at("NumLabels" ), *this)); |
3918 | |
3919 | SparseLabelSplitNode *loadedNode = G_->addNode(new SparseLabelSplitNode(opName, LabelValuesOutTy, ExampleIdsOutTy, GradientOffsetMapOutTy, Lengths, Indices, Values, NumLabels)); |
3920 | |
3921 | if (dict.count("Predicate" )) { |
3922 | NodeValue Predicate; |
3923 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3924 | loadedNode->setPredicate(Predicate); |
3925 | } |
3926 | |
3927 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3928 | return loadedNode; |
3929 | } |
3930 | |
3931 | if (typeName == "Glow_Flip" ) { |
3932 | NodeValue Input; |
3933 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
3934 | |
3935 | TypeRef ResultOutTy; |
3936 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3937 | |
3938 | unsigned_t Axis; |
3939 | ASSIGN_VALUE_OR_RETURN_ERR(Axis, loadAttribute<unsigned_t>(dict.at("Axis" ), *this)); |
3940 | |
3941 | FlipNode *loadedNode = G_->addNode(new FlipNode(opName, ResultOutTy, Input, Axis)); |
3942 | |
3943 | if (dict.count("Predicate" )) { |
3944 | NodeValue Predicate; |
3945 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3946 | loadedNode->setPredicate(Predicate); |
3947 | } |
3948 | |
3949 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3950 | return loadedNode; |
3951 | } |
3952 | |
3953 | if (typeName == "Glow_Splat" ) { |
3954 | TypeRef ResultOutTy; |
3955 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3956 | |
3957 | float Value; |
3958 | ASSIGN_VALUE_OR_RETURN_ERR(Value, loadAttribute<float>(dict.at("Value" ), *this)); |
3959 | |
3960 | SplatNode *loadedNode = G_->addNode(new SplatNode(opName, ResultOutTy, Value)); |
3961 | |
3962 | if (dict.count("Predicate" )) { |
3963 | NodeValue Predicate; |
3964 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3965 | loadedNode->setPredicate(Predicate); |
3966 | } |
3967 | |
3968 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3969 | return loadedNode; |
3970 | } |
3971 | |
3972 | if (typeName == "Glow_Touch" ) { |
3973 | TypeRef ResultOutTy; |
3974 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
3975 | |
3976 | TouchNode *loadedNode = G_->addNode(new TouchNode(opName, ResultOutTy)); |
3977 | |
3978 | if (dict.count("Predicate" )) { |
3979 | NodeValue Predicate; |
3980 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
3981 | loadedNode->setPredicate(Predicate); |
3982 | } |
3983 | |
3984 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
3985 | return loadedNode; |
3986 | } |
3987 | |
3988 | if (typeName == "Glow_SGD" ) { |
3989 | NodeValue Gradient; |
3990 | ASSIGN_VALUE_OR_RETURN_ERR(Gradient, getNodeValueByName(op.input(0))); |
3991 | |
3992 | NodeValue Weight; |
3993 | ASSIGN_VALUE_OR_RETURN_ERR(Weight, getNodeValueByName(op.input(1))); |
3994 | |
3995 | float L1Decay; |
3996 | ASSIGN_VALUE_OR_RETURN_ERR(L1Decay, loadAttribute<float>(dict.at("L1Decay" ), *this)); |
3997 | |
3998 | float L2Decay; |
3999 | ASSIGN_VALUE_OR_RETURN_ERR(L2Decay, loadAttribute<float>(dict.at("L2Decay" ), *this)); |
4000 | |
4001 | float LearningRate; |
4002 | ASSIGN_VALUE_OR_RETURN_ERR(LearningRate, loadAttribute<float>(dict.at("LearningRate" ), *this)); |
4003 | |
4004 | float Momentum; |
4005 | ASSIGN_VALUE_OR_RETURN_ERR(Momentum, loadAttribute<float>(dict.at("Momentum" ), *this)); |
4006 | |
4007 | unsigned_t BatchSize; |
4008 | ASSIGN_VALUE_OR_RETURN_ERR(BatchSize, loadAttribute<unsigned_t>(dict.at("BatchSize" ), *this)); |
4009 | |
4010 | SGDNode *loadedNode = G_->addNode(new SGDNode(opName, Gradient, Weight, L1Decay, L2Decay, LearningRate, Momentum, BatchSize)); |
4011 | |
4012 | if (dict.count("Predicate" )) { |
4013 | NodeValue Predicate; |
4014 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4015 | loadedNode->setPredicate(Predicate); |
4016 | } |
4017 | |
4018 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4019 | return loadedNode; |
4020 | } |
4021 | |
4022 | if (typeName == "Glow_TraceEvent" ) { |
4023 | NodeValue Data; |
4024 | ASSIGN_VALUE_OR_RETURN_ERR(Data, getNodeValueByName(op.input(0))); |
4025 | |
4026 | std::string EventName; |
4027 | ASSIGN_VALUE_OR_RETURN_ERR(EventName, loadAttribute<std::string>(dict.at("EventName" ), *this)); |
4028 | |
4029 | std::string EventType; |
4030 | ASSIGN_VALUE_OR_RETURN_ERR(EventType, loadAttribute<std::string>(dict.at("EventType" ), *this)); |
4031 | |
4032 | unsigned_t Index; |
4033 | ASSIGN_VALUE_OR_RETURN_ERR(Index, loadAttribute<unsigned_t>(dict.at("Index" ), *this)); |
4034 | |
4035 | TraceEventNode *loadedNode = G_->addNode(new TraceEventNode(opName, Data, EventName, EventType, Index)); |
4036 | |
4037 | if (dict.count("Predicate" )) { |
4038 | NodeValue Predicate; |
4039 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4040 | loadedNode->setPredicate(Predicate); |
4041 | } |
4042 | |
4043 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4044 | return loadedNode; |
4045 | } |
4046 | |
4047 | if (typeName == "Glow_QuantizationProfile" ) { |
4048 | NodeValue Input; |
4049 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4050 | |
4051 | NodeValue Histogram; |
4052 | ASSIGN_VALUE_OR_RETURN_ERR(Histogram, getNodeValueByName(op.input(1))); |
4053 | |
4054 | NodeValue ComputationInfo; |
4055 | ASSIGN_VALUE_OR_RETURN_ERR(ComputationInfo, getNodeValueByName(op.input(2))); |
4056 | |
4057 | std::string ProfiledNodeName; |
4058 | ASSIGN_VALUE_OR_RETURN_ERR(ProfiledNodeName, loadAttribute<std::string>(dict.at("ProfiledNodeName" ), *this)); |
4059 | |
4060 | unsigned_t ProfiledOutputNumber; |
4061 | ASSIGN_VALUE_OR_RETURN_ERR(ProfiledOutputNumber, loadAttribute<unsigned_t>(dict.at("ProfiledOutputNumber" ), *this)); |
4062 | |
4063 | QuantizationProfileNode *loadedNode = G_->addNode(new QuantizationProfileNode(opName, Input, Histogram, ComputationInfo, ProfiledNodeName, ProfiledOutputNumber)); |
4064 | |
4065 | if (dict.count("Predicate" )) { |
4066 | NodeValue Predicate; |
4067 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4068 | loadedNode->setPredicate(Predicate); |
4069 | } |
4070 | |
4071 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4072 | return loadedNode; |
4073 | } |
4074 | |
4075 | if (typeName == "Glow_IntLookupTable" ) { |
4076 | NodeValue Input; |
4077 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4078 | |
4079 | NodeValue Mapping; |
4080 | ASSIGN_VALUE_OR_RETURN_ERR(Mapping, getNodeValueByName(op.input(1))); |
4081 | |
4082 | TypeRef ResultOutTy; |
4083 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4084 | |
4085 | IntLookupTableNode *loadedNode = G_->addNode(new IntLookupTableNode(opName, ResultOutTy, Input, Mapping)); |
4086 | |
4087 | if (dict.count("Predicate" )) { |
4088 | NodeValue Predicate; |
4089 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4090 | loadedNode->setPredicate(Predicate); |
4091 | } |
4092 | |
4093 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4094 | return loadedNode; |
4095 | } |
4096 | |
4097 | if (typeName == "Glow_Quantize" ) { |
4098 | NodeValue Input; |
4099 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4100 | |
4101 | TypeRef ResultOutTy; |
4102 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4103 | |
4104 | QuantizeNode *loadedNode = G_->addNode(new QuantizeNode(opName, ResultOutTy, Input)); |
4105 | |
4106 | if (dict.count("Predicate" )) { |
4107 | NodeValue Predicate; |
4108 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4109 | loadedNode->setPredicate(Predicate); |
4110 | } |
4111 | |
4112 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4113 | return loadedNode; |
4114 | } |
4115 | |
4116 | if (typeName == "Glow_Dequantize" ) { |
4117 | NodeValue Input; |
4118 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4119 | |
4120 | TypeRef ResultOutTy; |
4121 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4122 | |
4123 | DequantizeNode *loadedNode = G_->addNode(new DequantizeNode(opName, ResultOutTy, Input)); |
4124 | |
4125 | if (dict.count("Predicate" )) { |
4126 | NodeValue Predicate; |
4127 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4128 | loadedNode->setPredicate(Predicate); |
4129 | } |
4130 | |
4131 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4132 | return loadedNode; |
4133 | } |
4134 | |
4135 | if (typeName == "Glow_RescaleQuantized" ) { |
4136 | NodeValue Input; |
4137 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4138 | |
4139 | TypeRef ResultOutTy; |
4140 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4141 | |
4142 | RescaleQuantizedNode *loadedNode = G_->addNode(new RescaleQuantizedNode(opName, ResultOutTy, Input)); |
4143 | |
4144 | if (dict.count("Predicate" )) { |
4145 | NodeValue Predicate; |
4146 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4147 | loadedNode->setPredicate(Predicate); |
4148 | } |
4149 | |
4150 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4151 | return loadedNode; |
4152 | } |
4153 | |
4154 | if (typeName == "Glow_TopK" ) { |
4155 | NodeValue Input; |
4156 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4157 | |
4158 | TypeRef ValuesOutTy; |
4159 | ASSIGN_VALUE_OR_RETURN_ERR(ValuesOutTy, loadTypeFromAttributes(0, dict)); |
4160 | |
4161 | TypeRef IndicesOutTy; |
4162 | ASSIGN_VALUE_OR_RETURN_ERR(IndicesOutTy, loadTypeFromAttributes(1, dict)); |
4163 | |
4164 | unsigned_t K; |
4165 | ASSIGN_VALUE_OR_RETURN_ERR(K, loadAttribute<unsigned_t>(dict.at("K" ), *this)); |
4166 | |
4167 | TopKNode *loadedNode = G_->addNode(new TopKNode(opName, ValuesOutTy, IndicesOutTy, Input, K)); |
4168 | |
4169 | if (dict.count("Predicate" )) { |
4170 | NodeValue Predicate; |
4171 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4172 | loadedNode->setPredicate(Predicate); |
4173 | } |
4174 | |
4175 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4176 | return loadedNode; |
4177 | } |
4178 | |
4179 | if (typeName == "Glow_LSTMUnit" ) { |
4180 | NodeValue Input; |
4181 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4182 | |
4183 | NodeValue C; |
4184 | ASSIGN_VALUE_OR_RETURN_ERR(C, getNodeValueByName(op.input(1))); |
4185 | |
4186 | LSTMUnitNode *loadedNode = G_->addNode(new LSTMUnitNode(opName, Input, C)); |
4187 | |
4188 | if (dict.count("Predicate" )) { |
4189 | NodeValue Predicate; |
4190 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4191 | loadedNode->setPredicate(Predicate); |
4192 | } |
4193 | |
4194 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4195 | return loadedNode; |
4196 | } |
4197 | |
4198 | if (typeName == "Glow_ConvertTo" ) { |
4199 | NodeValue Input; |
4200 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4201 | |
4202 | TypeRef ResultOutTy; |
4203 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4204 | |
4205 | ConvertToNode *loadedNode = G_->addNode(new ConvertToNode(opName, ResultOutTy, Input)); |
4206 | |
4207 | if (dict.count("Predicate" )) { |
4208 | NodeValue Predicate; |
4209 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4210 | loadedNode->setPredicate(Predicate); |
4211 | } |
4212 | |
4213 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4214 | return loadedNode; |
4215 | } |
4216 | |
4217 | if (typeName == "Glow_AudioSpectrogram" ) { |
4218 | NodeValue Input; |
4219 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4220 | |
4221 | NodeValue Window; |
4222 | ASSIGN_VALUE_OR_RETURN_ERR(Window, getNodeValueByName(op.input(1))); |
4223 | |
4224 | NodeValue TwiddleFactors; |
4225 | ASSIGN_VALUE_OR_RETURN_ERR(TwiddleFactors, getNodeValueByName(op.input(2))); |
4226 | |
4227 | NodeValue BitReverseIndices; |
4228 | ASSIGN_VALUE_OR_RETURN_ERR(BitReverseIndices, getNodeValueByName(op.input(3))); |
4229 | |
4230 | NodeValue ComplexToRealWeights; |
4231 | ASSIGN_VALUE_OR_RETURN_ERR(ComplexToRealWeights, getNodeValueByName(op.input(4))); |
4232 | |
4233 | TypeRef SpectrogramOutTy; |
4234 | ASSIGN_VALUE_OR_RETURN_ERR(SpectrogramOutTy, loadTypeFromAttributes(0, dict)); |
4235 | |
4236 | unsigned_t WindowSize; |
4237 | ASSIGN_VALUE_OR_RETURN_ERR(WindowSize, loadAttribute<unsigned_t>(dict.at("WindowSize" ), *this)); |
4238 | |
4239 | unsigned_t WindowStride; |
4240 | ASSIGN_VALUE_OR_RETURN_ERR(WindowStride, loadAttribute<unsigned_t>(dict.at("WindowStride" ), *this)); |
4241 | |
4242 | bool MagnitudeSquared; |
4243 | ASSIGN_VALUE_OR_RETURN_ERR(MagnitudeSquared, loadAttribute<bool>(dict.at("MagnitudeSquared" ), *this)); |
4244 | |
4245 | AudioSpectrogramNode *loadedNode = G_->addNode(new AudioSpectrogramNode(opName, SpectrogramOutTy, Input, Window, TwiddleFactors, BitReverseIndices, ComplexToRealWeights, WindowSize, WindowStride, MagnitudeSquared)); |
4246 | |
4247 | if (dict.count("Predicate" )) { |
4248 | NodeValue Predicate; |
4249 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4250 | loadedNode->setPredicate(Predicate); |
4251 | } |
4252 | |
4253 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4254 | return loadedNode; |
4255 | } |
4256 | |
4257 | if (typeName == "Glow_MFCC" ) { |
4258 | NodeValue Spectrogram; |
4259 | ASSIGN_VALUE_OR_RETURN_ERR(Spectrogram, getNodeValueByName(op.input(0))); |
4260 | |
4261 | NodeValue MelWeights; |
4262 | ASSIGN_VALUE_OR_RETURN_ERR(MelWeights, getNodeValueByName(op.input(1))); |
4263 | |
4264 | NodeValue MelRanges; |
4265 | ASSIGN_VALUE_OR_RETURN_ERR(MelRanges, getNodeValueByName(op.input(2))); |
4266 | |
4267 | NodeValue DctMat; |
4268 | ASSIGN_VALUE_OR_RETURN_ERR(DctMat, getNodeValueByName(op.input(3))); |
4269 | |
4270 | TypeRef CoefficientsOutTy; |
4271 | ASSIGN_VALUE_OR_RETURN_ERR(CoefficientsOutTy, loadTypeFromAttributes(0, dict)); |
4272 | |
4273 | float SampleRate; |
4274 | ASSIGN_VALUE_OR_RETURN_ERR(SampleRate, loadAttribute<float>(dict.at("SampleRate" ), *this)); |
4275 | |
4276 | float LowerFrequency; |
4277 | ASSIGN_VALUE_OR_RETURN_ERR(LowerFrequency, loadAttribute<float>(dict.at("LowerFrequency" ), *this)); |
4278 | |
4279 | float UpperFrequency; |
4280 | ASSIGN_VALUE_OR_RETURN_ERR(UpperFrequency, loadAttribute<float>(dict.at("UpperFrequency" ), *this)); |
4281 | |
4282 | unsigned_t FilterBankCount; |
4283 | ASSIGN_VALUE_OR_RETURN_ERR(FilterBankCount, loadAttribute<unsigned_t>(dict.at("FilterBankCount" ), *this)); |
4284 | |
4285 | unsigned_t NumCoefficients; |
4286 | ASSIGN_VALUE_OR_RETURN_ERR(NumCoefficients, loadAttribute<unsigned_t>(dict.at("NumCoefficients" ), *this)); |
4287 | |
4288 | MFCCNode *loadedNode = G_->addNode(new MFCCNode(opName, CoefficientsOutTy, Spectrogram, MelWeights, MelRanges, DctMat, SampleRate, LowerFrequency, UpperFrequency, FilterBankCount, NumCoefficients)); |
4289 | |
4290 | if (dict.count("Predicate" )) { |
4291 | NodeValue Predicate; |
4292 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4293 | loadedNode->setPredicate(Predicate); |
4294 | } |
4295 | |
4296 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4297 | return loadedNode; |
4298 | } |
4299 | |
4300 | if (typeName == "Glow_NonMaxSuppression" ) { |
4301 | NodeValue Boxes; |
4302 | ASSIGN_VALUE_OR_RETURN_ERR(Boxes, getNodeValueByName(op.input(0))); |
4303 | |
4304 | NodeValue Scores; |
4305 | ASSIGN_VALUE_OR_RETURN_ERR(Scores, getNodeValueByName(op.input(1))); |
4306 | |
4307 | TypeRef IndicesOutTy; |
4308 | ASSIGN_VALUE_OR_RETURN_ERR(IndicesOutTy, loadTypeFromAttributes(0, dict)); |
4309 | |
4310 | TypeRef NumberOfSelectedIndicesOutTy; |
4311 | ASSIGN_VALUE_OR_RETURN_ERR(NumberOfSelectedIndicesOutTy, loadTypeFromAttributes(1, dict)); |
4312 | |
4313 | unsigned_t CenterPointBox; |
4314 | ASSIGN_VALUE_OR_RETURN_ERR(CenterPointBox, loadAttribute<unsigned_t>(dict.at("CenterPointBox" ), *this)); |
4315 | |
4316 | unsigned_t MaxOutputBoxesPerClass; |
4317 | ASSIGN_VALUE_OR_RETURN_ERR(MaxOutputBoxesPerClass, loadAttribute<unsigned_t>(dict.at("MaxOutputBoxesPerClass" ), *this)); |
4318 | |
4319 | float IouThreshold; |
4320 | ASSIGN_VALUE_OR_RETURN_ERR(IouThreshold, loadAttribute<float>(dict.at("IouThreshold" ), *this)); |
4321 | |
4322 | float ScoreThreshold; |
4323 | ASSIGN_VALUE_OR_RETURN_ERR(ScoreThreshold, loadAttribute<float>(dict.at("ScoreThreshold" ), *this)); |
4324 | |
4325 | bool IsTFVersion4; |
4326 | ASSIGN_VALUE_OR_RETURN_ERR(IsTFVersion4, loadAttribute<bool>(dict.at("IsTFVersion4" ), *this)); |
4327 | |
4328 | NonMaxSuppressionNode *loadedNode = G_->addNode(new NonMaxSuppressionNode(opName, IndicesOutTy, NumberOfSelectedIndicesOutTy, Boxes, Scores, CenterPointBox, MaxOutputBoxesPerClass, IouThreshold, ScoreThreshold, IsTFVersion4)); |
4329 | |
4330 | if (dict.count("Predicate" )) { |
4331 | NodeValue Predicate; |
4332 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4333 | loadedNode->setPredicate(Predicate); |
4334 | } |
4335 | |
4336 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4337 | return loadedNode; |
4338 | } |
4339 | |
4340 | if (typeName == "Glow_TFLiteDetectionPostProcess" ) { |
4341 | NodeValue Boxes; |
4342 | ASSIGN_VALUE_OR_RETURN_ERR(Boxes, getNodeValueByName(op.input(0))); |
4343 | |
4344 | NodeValue Scores; |
4345 | ASSIGN_VALUE_OR_RETURN_ERR(Scores, getNodeValueByName(op.input(1))); |
4346 | |
4347 | NodeValue Anchors; |
4348 | ASSIGN_VALUE_OR_RETURN_ERR(Anchors, getNodeValueByName(op.input(2))); |
4349 | |
4350 | TypeRef DetectionBoxesOutTy; |
4351 | ASSIGN_VALUE_OR_RETURN_ERR(DetectionBoxesOutTy, loadTypeFromAttributes(0, dict)); |
4352 | |
4353 | TypeRef DetectionClassesOutTy; |
4354 | ASSIGN_VALUE_OR_RETURN_ERR(DetectionClassesOutTy, loadTypeFromAttributes(1, dict)); |
4355 | |
4356 | TypeRef DetectionScoresOutTy; |
4357 | ASSIGN_VALUE_OR_RETURN_ERR(DetectionScoresOutTy, loadTypeFromAttributes(2, dict)); |
4358 | |
4359 | TypeRef NumDetectionsOutTy; |
4360 | ASSIGN_VALUE_OR_RETURN_ERR(NumDetectionsOutTy, loadTypeFromAttributes(3, dict)); |
4361 | |
4362 | unsigned_t NumClasses; |
4363 | ASSIGN_VALUE_OR_RETURN_ERR(NumClasses, loadAttribute<unsigned_t>(dict.at("NumClasses" ), *this)); |
4364 | |
4365 | unsigned_t MaxDetections; |
4366 | ASSIGN_VALUE_OR_RETURN_ERR(MaxDetections, loadAttribute<unsigned_t>(dict.at("MaxDetections" ), *this)); |
4367 | |
4368 | unsigned_t MaxClassesPerDetection; |
4369 | ASSIGN_VALUE_OR_RETURN_ERR(MaxClassesPerDetection, loadAttribute<unsigned_t>(dict.at("MaxClassesPerDetection" ), *this)); |
4370 | |
4371 | unsigned_t MaxDetectionsPerClass; |
4372 | ASSIGN_VALUE_OR_RETURN_ERR(MaxDetectionsPerClass, loadAttribute<unsigned_t>(dict.at("MaxDetectionsPerClass" ), *this)); |
4373 | |
4374 | float IouThreshold; |
4375 | ASSIGN_VALUE_OR_RETURN_ERR(IouThreshold, loadAttribute<float>(dict.at("IouThreshold" ), *this)); |
4376 | |
4377 | float ScoreThreshold; |
4378 | ASSIGN_VALUE_OR_RETURN_ERR(ScoreThreshold, loadAttribute<float>(dict.at("ScoreThreshold" ), *this)); |
4379 | |
4380 | float XScale; |
4381 | ASSIGN_VALUE_OR_RETURN_ERR(XScale, loadAttribute<float>(dict.at("XScale" ), *this)); |
4382 | |
4383 | float YScale; |
4384 | ASSIGN_VALUE_OR_RETURN_ERR(YScale, loadAttribute<float>(dict.at("YScale" ), *this)); |
4385 | |
4386 | float HScale; |
4387 | ASSIGN_VALUE_OR_RETURN_ERR(HScale, loadAttribute<float>(dict.at("HScale" ), *this)); |
4388 | |
4389 | float WScale; |
4390 | ASSIGN_VALUE_OR_RETURN_ERR(WScale, loadAttribute<float>(dict.at("WScale" ), *this)); |
4391 | |
4392 | bool RegularNMS; |
4393 | ASSIGN_VALUE_OR_RETURN_ERR(RegularNMS, loadAttribute<bool>(dict.at("RegularNMS" ), *this)); |
4394 | |
4395 | TFLiteDetectionPostProcessNode *loadedNode = G_->addNode(new TFLiteDetectionPostProcessNode(opName, DetectionBoxesOutTy, DetectionClassesOutTy, DetectionScoresOutTy, NumDetectionsOutTy, Boxes, Scores, Anchors, NumClasses, MaxDetections, MaxClassesPerDetection, MaxDetectionsPerClass, IouThreshold, ScoreThreshold, XScale, YScale, HScale, WScale, RegularNMS)); |
4396 | |
4397 | if (dict.count("Predicate" )) { |
4398 | NodeValue Predicate; |
4399 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4400 | loadedNode->setPredicate(Predicate); |
4401 | } |
4402 | |
4403 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4404 | return loadedNode; |
4405 | } |
4406 | |
4407 | if (typeName == "Glow_ROIAlign" ) { |
4408 | NodeValue FeatureMap; |
4409 | ASSIGN_VALUE_OR_RETURN_ERR(FeatureMap, getNodeValueByName(op.input(0))); |
4410 | |
4411 | NodeValue Boxes; |
4412 | ASSIGN_VALUE_OR_RETURN_ERR(Boxes, getNodeValueByName(op.input(1))); |
4413 | |
4414 | NodeValue BatchIndices; |
4415 | ASSIGN_VALUE_OR_RETURN_ERR(BatchIndices, getNodeValueByName(op.input(2))); |
4416 | |
4417 | TypeRef ResultOutTy; |
4418 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4419 | |
4420 | unsigned_t Mode; |
4421 | ASSIGN_VALUE_OR_RETURN_ERR(Mode, loadAttribute<unsigned_t>(dict.at("Mode" ), *this)); |
4422 | |
4423 | unsigned_t OutputHeight; |
4424 | ASSIGN_VALUE_OR_RETURN_ERR(OutputHeight, loadAttribute<unsigned_t>(dict.at("OutputHeight" ), *this)); |
4425 | |
4426 | unsigned_t OutputWidth; |
4427 | ASSIGN_VALUE_OR_RETURN_ERR(OutputWidth, loadAttribute<unsigned_t>(dict.at("OutputWidth" ), *this)); |
4428 | |
4429 | unsigned_t SamplingRatio; |
4430 | ASSIGN_VALUE_OR_RETURN_ERR(SamplingRatio, loadAttribute<unsigned_t>(dict.at("SamplingRatio" ), *this)); |
4431 | |
4432 | float SpatialScale; |
4433 | ASSIGN_VALUE_OR_RETURN_ERR(SpatialScale, loadAttribute<float>(dict.at("SpatialScale" ), *this)); |
4434 | |
4435 | bool Aligned; |
4436 | ASSIGN_VALUE_OR_RETURN_ERR(Aligned, loadAttribute<bool>(dict.at("Aligned" ), *this)); |
4437 | |
4438 | bool Rotated; |
4439 | ASSIGN_VALUE_OR_RETURN_ERR(Rotated, loadAttribute<bool>(dict.at("Rotated" ), *this)); |
4440 | |
4441 | ROIAlignNode *loadedNode = G_->addNode(new ROIAlignNode(opName, ResultOutTy, FeatureMap, Boxes, BatchIndices, Mode, OutputHeight, OutputWidth, SamplingRatio, SpatialScale, Aligned, Rotated)); |
4442 | |
4443 | if (dict.count("Predicate" )) { |
4444 | NodeValue Predicate; |
4445 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4446 | loadedNode->setPredicate(Predicate); |
4447 | } |
4448 | |
4449 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4450 | return loadedNode; |
4451 | } |
4452 | |
4453 | if (typeName == "Glow_BBoxTransform" ) { |
4454 | NodeValue Rois; |
4455 | ASSIGN_VALUE_OR_RETURN_ERR(Rois, getNodeValueByName(op.input(0))); |
4456 | |
4457 | NodeValue Deltas; |
4458 | ASSIGN_VALUE_OR_RETURN_ERR(Deltas, getNodeValueByName(op.input(1))); |
4459 | |
4460 | NodeValue ImInfo; |
4461 | ASSIGN_VALUE_OR_RETURN_ERR(ImInfo, getNodeValueByName(op.input(2))); |
4462 | |
4463 | TypeRef BoxOutOutTy; |
4464 | ASSIGN_VALUE_OR_RETURN_ERR(BoxOutOutTy, loadTypeFromAttributes(0, dict)); |
4465 | |
4466 | TypeRef RoiBatchSplitsOutTy; |
4467 | ASSIGN_VALUE_OR_RETURN_ERR(RoiBatchSplitsOutTy, loadTypeFromAttributes(1, dict)); |
4468 | |
4469 | std::vector<float> Weights; |
4470 | ASSIGN_VALUE_OR_RETURN_ERR(Weights, loadAttribute<std::vector<float>>(dict.at("Weights" ), *this)); |
4471 | |
4472 | bool ApplyScale; |
4473 | ASSIGN_VALUE_OR_RETURN_ERR(ApplyScale, loadAttribute<bool>(dict.at("ApplyScale" ), *this)); |
4474 | |
4475 | bool Rotated; |
4476 | ASSIGN_VALUE_OR_RETURN_ERR(Rotated, loadAttribute<bool>(dict.at("Rotated" ), *this)); |
4477 | |
4478 | bool AngleBoundOn; |
4479 | ASSIGN_VALUE_OR_RETURN_ERR(AngleBoundOn, loadAttribute<bool>(dict.at("AngleBoundOn" ), *this)); |
4480 | |
4481 | int64_t AngleBoundLo; |
4482 | ASSIGN_VALUE_OR_RETURN_ERR(AngleBoundLo, loadAttribute<int64_t>(dict.at("AngleBoundLo" ), *this)); |
4483 | |
4484 | int64_t AngleBoundHi; |
4485 | ASSIGN_VALUE_OR_RETURN_ERR(AngleBoundHi, loadAttribute<int64_t>(dict.at("AngleBoundHi" ), *this)); |
4486 | |
4487 | float ClipAngleThresh; |
4488 | ASSIGN_VALUE_OR_RETURN_ERR(ClipAngleThresh, loadAttribute<float>(dict.at("ClipAngleThresh" ), *this)); |
4489 | |
4490 | bool LegacyPlusOne; |
4491 | ASSIGN_VALUE_OR_RETURN_ERR(LegacyPlusOne, loadAttribute<bool>(dict.at("LegacyPlusOne" ), *this)); |
4492 | |
4493 | BBoxTransformNode *loadedNode = G_->addNode(new BBoxTransformNode(opName, BoxOutOutTy, RoiBatchSplitsOutTy, Rois, Deltas, ImInfo, Weights, ApplyScale, Rotated, AngleBoundOn, AngleBoundLo, AngleBoundHi, ClipAngleThresh, LegacyPlusOne)); |
4494 | |
4495 | if (dict.count("Predicate" )) { |
4496 | NodeValue Predicate; |
4497 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4498 | loadedNode->setPredicate(Predicate); |
4499 | } |
4500 | |
4501 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4502 | return loadedNode; |
4503 | } |
4504 | |
4505 | if (typeName == "Glow_CollectRpnProposals" ) { |
4506 | TypeRef ResultOutTy; |
4507 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4508 | |
4509 | std::vector<NodeValue> RoisIn; |
4510 | ASSIGN_VALUE_OR_RETURN_ERR(RoisIn, loadAttribute<std::vector<NodeValue>>(dict.at("RoisIn" ), *this)); |
4511 | |
4512 | std::vector<NodeValue> RoisProbsIn; |
4513 | ASSIGN_VALUE_OR_RETURN_ERR(RoisProbsIn, loadAttribute<std::vector<NodeValue>>(dict.at("RoisProbsIn" ), *this)); |
4514 | |
4515 | int64_t RpnMaxLevel; |
4516 | ASSIGN_VALUE_OR_RETURN_ERR(RpnMaxLevel, loadAttribute<int64_t>(dict.at("RpnMaxLevel" ), *this)); |
4517 | |
4518 | int64_t RpnMinLevel; |
4519 | ASSIGN_VALUE_OR_RETURN_ERR(RpnMinLevel, loadAttribute<int64_t>(dict.at("RpnMinLevel" ), *this)); |
4520 | |
4521 | unsigned_t RpnPostNmsTopN; |
4522 | ASSIGN_VALUE_OR_RETURN_ERR(RpnPostNmsTopN, loadAttribute<unsigned_t>(dict.at("RpnPostNmsTopN" ), *this)); |
4523 | |
4524 | CollectRpnProposalsNode *loadedNode = G_->addNode(new CollectRpnProposalsNode(opName, ResultOutTy, RoisIn, RoisProbsIn, RpnMaxLevel, RpnMinLevel, RpnPostNmsTopN)); |
4525 | |
4526 | if (dict.count("Predicate" )) { |
4527 | NodeValue Predicate; |
4528 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4529 | loadedNode->setPredicate(Predicate); |
4530 | } |
4531 | |
4532 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4533 | return loadedNode; |
4534 | } |
4535 | |
4536 | if (typeName == "Glow_LookupTable" ) { |
4537 | NodeValue Input; |
4538 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4539 | |
4540 | NodeValue Table; |
4541 | ASSIGN_VALUE_OR_RETURN_ERR(Table, getNodeValueByName(op.input(1))); |
4542 | |
4543 | NodeValue TableIdx; |
4544 | ASSIGN_VALUE_OR_RETURN_ERR(TableIdx, getNodeValueByName(op.input(2))); |
4545 | |
4546 | TypeRef ResultOutTy; |
4547 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4548 | |
4549 | glow::LUTOperator Operator; |
4550 | ASSIGN_VALUE_OR_RETURN_ERR(Operator, loadAttribute<glow::LUTOperator>(dict.at("Operator" ), *this)); |
4551 | |
4552 | std::vector<float> OperatorArgs; |
4553 | ASSIGN_VALUE_OR_RETURN_ERR(OperatorArgs, loadAttribute<std::vector<float>>(dict.at("OperatorArgs" ), *this)); |
4554 | |
4555 | LookupTableNode *loadedNode = G_->addNode(new LookupTableNode(opName, ResultOutTy, Input, Table, TableIdx, Operator, OperatorArgs)); |
4556 | |
4557 | if (dict.count("Predicate" )) { |
4558 | NodeValue Predicate; |
4559 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4560 | loadedNode->setPredicate(Predicate); |
4561 | } |
4562 | |
4563 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4564 | return loadedNode; |
4565 | } |
4566 | |
4567 | if (typeName == "Glow_CPUMaxSplat" ) { |
4568 | NodeValue Input; |
4569 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4570 | |
4571 | float SplatValue; |
4572 | ASSIGN_VALUE_OR_RETURN_ERR(SplatValue, loadAttribute<float>(dict.at("SplatValue" ), *this)); |
4573 | |
4574 | CPUMaxSplatNode *loadedNode = G_->addNode(new CPUMaxSplatNode(opName, Input, SplatValue)); |
4575 | |
4576 | if (dict.count("Predicate" )) { |
4577 | NodeValue Predicate; |
4578 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4579 | loadedNode->setPredicate(Predicate); |
4580 | } |
4581 | |
4582 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4583 | return loadedNode; |
4584 | } |
4585 | |
4586 | if (typeName == "Glow_CPUConvDKKC8" ) { |
4587 | NodeValue Input; |
4588 | ASSIGN_VALUE_OR_RETURN_ERR(Input, getNodeValueByName(op.input(0))); |
4589 | |
4590 | NodeValue Filter; |
4591 | ASSIGN_VALUE_OR_RETURN_ERR(Filter, getNodeValueByName(op.input(1))); |
4592 | |
4593 | NodeValue Bias; |
4594 | ASSIGN_VALUE_OR_RETURN_ERR(Bias, getNodeValueByName(op.input(2))); |
4595 | |
4596 | TypeRef ResultOutTy; |
4597 | ASSIGN_VALUE_OR_RETURN_ERR(ResultOutTy, loadTypeFromAttributes(0, dict)); |
4598 | |
4599 | std::vector<unsigned_t> Kernels; |
4600 | ASSIGN_VALUE_OR_RETURN_ERR(Kernels, loadAttribute<std::vector<unsigned_t>>(dict.at("Kernels" ), *this)); |
4601 | |
4602 | std::vector<unsigned_t> Strides; |
4603 | ASSIGN_VALUE_OR_RETURN_ERR(Strides, loadAttribute<std::vector<unsigned_t>>(dict.at("Strides" ), *this)); |
4604 | |
4605 | std::vector<unsigned_t> Pads; |
4606 | ASSIGN_VALUE_OR_RETURN_ERR(Pads, loadAttribute<std::vector<unsigned_t>>(dict.at("Pads" ), *this)); |
4607 | |
4608 | unsigned_t Group; |
4609 | ASSIGN_VALUE_OR_RETURN_ERR(Group, loadAttribute<unsigned_t>(dict.at("Group" ), *this)); |
4610 | |
4611 | CPUConvDKKC8Node *loadedNode = G_->addNode(new CPUConvDKKC8Node(opName, ResultOutTy, Input, Filter, Bias, Kernels, Strides, Pads, Group)); |
4612 | |
4613 | if (dict.count("Predicate" )) { |
4614 | NodeValue Predicate; |
4615 | ASSIGN_VALUE_OR_RETURN_ERR(Predicate, loadAttribute<NodeValue>(dict.at("Predicate" ), *this)); |
4616 | loadedNode->setPredicate(Predicate); |
4617 | } |
4618 | |
4619 | RETURN_IF_ERR(addNodeAsOutput(op, loadedNode)); |
4620 | return loadedNode; |
4621 | } |
4622 | |
4623 | |