1 /**
2 * @generated
3 * This is an auto-generated file. Please do not modify it by hand.
4 * To re-generate, please run:
5 * cd ~/pytorch && python torchgen/operator_versions/gen_mobile_upgraders.py
6 */
7
8 #include <caffe2/serialize/versions.h>
9 #include <torch/csrc/jit/mobile/upgrader_mobile.h>
10
11 namespace c10 {
12 TypePtr parseType(const std::string& pythonStr);
13 } // namespace c10
14
15 namespace torch::jit {
16
17 // clang-format off
18
19 // From operator_versions_map
20
21 const std::unordered_map<std::string, std::vector<Upgrader>>
getOperatorVersionMapForMobile()22 getOperatorVersionMapForMobile() {
23 static std::unordered_map<std::string, std::vector<Upgrader>>
24 operatorVersionMapForMobile({
25 {std::string("aten::div.Scalar"),
26 std::vector<Upgrader>({
27 Upgrader({0, 3, "div_Scalar_0_3", 0})
28 })},
29 {std::string("aten::div.Scalar_mode"),
30 std::vector<Upgrader>({
31 Upgrader({0, 3, "div_Scalar_mode_0_3", 1})
32 })},
33 {std::string("aten::div.Tensor"),
34 std::vector<Upgrader>({
35 Upgrader({0, 3, "div_Tensor_0_3", 2})
36 })},
37 {std::string("aten::div.Tensor_mode"),
38 std::vector<Upgrader>({
39 Upgrader({0, 3, "div_Tensor_mode_0_3", 3})
40 })},
41 {std::string("aten::div.out"),
42 std::vector<Upgrader>({
43 Upgrader({0, 3, "div_out_0_3", 8})
44 })},
45 {std::string("aten::div.out_mode"),
46 std::vector<Upgrader>({
47 Upgrader({0, 3, "div_out_mode_0_3", 9})
48 })},
49 {std::string("aten::div_.Scalar"),
50 std::vector<Upgrader>({
51 Upgrader({0, 3, "div__Scalar_0_3", 4})
52 })},
53 {std::string("aten::div_.Scalar_mode"),
54 std::vector<Upgrader>({
55 Upgrader({0, 3, "div__Scalar_mode_0_3", 5})
56 })},
57 {std::string("aten::div_.Tensor"),
58 std::vector<Upgrader>({
59 Upgrader({0, 3, "div__Tensor_0_3", 6})
60 })},
61 {std::string("aten::div_.Tensor_mode"),
62 std::vector<Upgrader>({
63 Upgrader({0, 3, "div__Tensor_mode_0_3", 7})
64 })},
65 {std::string("aten::gelu"),
66 std::vector<Upgrader>({
67 Upgrader({0, 9, "gelu_0_9", 11})
68 })},
69 {std::string("aten::gelu.out"),
70 std::vector<Upgrader>({
71 Upgrader({0, 9, "gelu_out_0_9", 12})
72 })},
73 {std::string("aten::linspace"),
74 std::vector<Upgrader>({
75 Upgrader({0, 7, "linspace_0_7", 13})
76 })},
77 {std::string("aten::linspace.out"),
78 std::vector<Upgrader>({
79 Upgrader({0, 7, "linspace_out_0_7", 14})
80 })},
81 {std::string("aten::logspace"),
82 std::vector<Upgrader>({
83 Upgrader({0, 8, "logspace_0_8", 15})
84 })},
85 {std::string("aten::logspace.out"),
86 std::vector<Upgrader>({
87 Upgrader({0, 8, "logspace_out_0_8", 16})
88 })},
89 });
90 return operatorVersionMapForMobile;
91 }
92
getUpgraderBytecodeList()93 const std::vector<ByteCodeFunctionWithOperator>& getUpgraderBytecodeList() {
94 auto generate_upgrader_bytecode_list = []() {
95 std::vector<ByteCodeFunctionWithOperator> upgrader_function_list({
96 ByteCodeFunctionWithOperator({
97 mobile::Function::registerFunc(
98 "div_Scalar_0_3",
99 std::vector<Instruction>({
100 Instruction{OpCode::STOREN, 1, 2},
101 Instruction{OpCode::LOAD, 1, 0},
102 Instruction{OpCode::OP, 0, 0},
103 Instruction{OpCode::JF, 3, 0},
104 Instruction{OpCode::LOADC, 1, 0},
105 Instruction{OpCode::JMP, 3, 0},
106 Instruction{OpCode::LOAD, 2, 0},
107 Instruction{OpCode::ISINSTANCE, 0, 1},
108 Instruction{OpCode::STORE, 3, 0},
109 Instruction{OpCode::MOVE, 3, 0},
110 Instruction{OpCode::JF, 5, 0},
111 Instruction{OpCode::LOAD, 1, 0},
112 Instruction{OpCode::LOAD, 2, 0},
113 Instruction{OpCode::OP, 1, 0},
114 Instruction{OpCode::JMP, 6, 0},
115 Instruction{OpCode::LOAD, 1, 0},
116 Instruction{OpCode::LOAD, 2, 0},
117 Instruction{OpCode::OP, 2, 0},
118 Instruction{OpCode::LOADC, 0, 0},
119 Instruction{OpCode::OP, 3, 0},
120 Instruction{OpCode::STORE, 4, 0},
121 Instruction{OpCode::DROPR, 2, 0},
122 Instruction{OpCode::DROPR, 1, 0},
123 Instruction{OpCode::MOVE, 4, 0},
124 Instruction{OpCode::RET, 0, 0},
125 }), // instructions list,
126 std::vector<c10::IValue>({
127 c10::IValue("trunc"),
128 c10::IValue(true),
129 }), // constants list,
130 std::vector<c10::TypePtr>({
131 c10::parseType("float"),
132 }), // types list,
133 4
134 ),
135 std::vector<OperatorString>({
136 OperatorString({"aten::is_floating_point", "", 1}),
137 OperatorString({"aten::div", "Scalar", 2}),
138 OperatorString({"prim::unchecked_cast", "", 1}),
139 OperatorString({"aten::div", "Scalar_mode", 3}),
140 }), // operators list
141 }),
142 ByteCodeFunctionWithOperator({
143 mobile::Function::registerFunc(
144 "div_Scalar_mode_0_3",
145 std::vector<Instruction>({
146 Instruction{OpCode::STOREN, 1, 3},
147 Instruction{OpCode::MOVE, 1, 0},
148 Instruction{OpCode::MOVE, 2, 0},
149 Instruction{OpCode::MOVE, 3, 0},
150 Instruction{OpCode::OP, 0, 0},
151 Instruction{OpCode::RET, 0, 0},
152 }), // instructions list,
153 std::vector<c10::IValue>(), // constants list,
154 std::vector<c10::TypePtr>(), // types list,
155 3
156 ),
157 std::vector<OperatorString>({
158 OperatorString({"aten::div", "Scalar_mode", 3}),
159 }), // operators list
160 }),
161 ByteCodeFunctionWithOperator({
162 mobile::Function::registerFunc(
163 "div_Tensor_0_3",
164 std::vector<Instruction>({
165 Instruction{OpCode::STOREN, 1, 2},
166 Instruction{OpCode::LOAD, 1, 0},
167 Instruction{OpCode::OP, 0, 0},
168 Instruction{OpCode::JF, 3, 0},
169 Instruction{OpCode::LOADC, 1, 0},
170 Instruction{OpCode::JMP, 3, 0},
171 Instruction{OpCode::LOAD, 2, 0},
172 Instruction{OpCode::OP, 0, 0},
173 Instruction{OpCode::STORE, 3, 0},
174 Instruction{OpCode::MOVE, 3, 0},
175 Instruction{OpCode::JF, 5, 0},
176 Instruction{OpCode::LOAD, 1, 0},
177 Instruction{OpCode::LOAD, 2, 0},
178 Instruction{OpCode::OP, 1, 0},
179 Instruction{OpCode::JMP, 5, 0},
180 Instruction{OpCode::LOAD, 1, 0},
181 Instruction{OpCode::LOAD, 2, 0},
182 Instruction{OpCode::LOADC, 0, 0},
183 Instruction{OpCode::OP, 2, 0},
184 Instruction{OpCode::STORE, 4, 0},
185 Instruction{OpCode::DROPR, 2, 0},
186 Instruction{OpCode::DROPR, 1, 0},
187 Instruction{OpCode::MOVE, 4, 0},
188 Instruction{OpCode::RET, 0, 0},
189 }), // instructions list,
190 std::vector<c10::IValue>({
191 c10::IValue("trunc"),
192 c10::IValue(true),
193 }), // constants list,
194 std::vector<c10::TypePtr>(), // types list,
195 4
196 ),
197 std::vector<OperatorString>({
198 OperatorString({"aten::is_floating_point", "", 1}),
199 OperatorString({"aten::div", "Tensor", 2}),
200 OperatorString({"aten::div", "Tensor_mode", 3}),
201 }), // operators list
202 }),
203 ByteCodeFunctionWithOperator({
204 mobile::Function::registerFunc(
205 "div_Tensor_mode_0_3",
206 std::vector<Instruction>({
207 Instruction{OpCode::STOREN, 1, 3},
208 Instruction{OpCode::MOVE, 1, 0},
209 Instruction{OpCode::MOVE, 2, 0},
210 Instruction{OpCode::MOVE, 3, 0},
211 Instruction{OpCode::OP, 0, 0},
212 Instruction{OpCode::RET, 0, 0},
213 }), // instructions list,
214 std::vector<c10::IValue>(), // constants list,
215 std::vector<c10::TypePtr>(), // types list,
216 3
217 ),
218 std::vector<OperatorString>({
219 OperatorString({"aten::div", "Tensor_mode", 3}),
220 }), // operators list
221 }),
222 ByteCodeFunctionWithOperator({
223 mobile::Function::registerFunc(
224 "div__Scalar_0_3",
225 std::vector<Instruction>({
226 Instruction{OpCode::STOREN, 1, 2},
227 Instruction{OpCode::LOAD, 1, 0},
228 Instruction{OpCode::OP, 0, 0},
229 Instruction{OpCode::JF, 3, 0},
230 Instruction{OpCode::LOADC, 1, 0},
231 Instruction{OpCode::JMP, 3, 0},
232 Instruction{OpCode::LOAD, 2, 0},
233 Instruction{OpCode::ISINSTANCE, 0, 1},
234 Instruction{OpCode::STORE, 3, 0},
235 Instruction{OpCode::MOVE, 3, 0},
236 Instruction{OpCode::JF, 5, 0},
237 Instruction{OpCode::LOAD, 1, 0},
238 Instruction{OpCode::LOAD, 2, 0},
239 Instruction{OpCode::OP, 1, 0},
240 Instruction{OpCode::JMP, 6, 0},
241 Instruction{OpCode::LOAD, 1, 0},
242 Instruction{OpCode::LOAD, 2, 0},
243 Instruction{OpCode::OP, 2, 0},
244 Instruction{OpCode::LOADC, 0, 0},
245 Instruction{OpCode::OP, 3, 0},
246 Instruction{OpCode::STORE, 4, 0},
247 Instruction{OpCode::DROPR, 2, 0},
248 Instruction{OpCode::DROPR, 1, 0},
249 Instruction{OpCode::MOVE, 4, 0},
250 Instruction{OpCode::RET, 0, 0},
251 }), // instructions list,
252 std::vector<c10::IValue>({
253 c10::IValue("trunc"),
254 c10::IValue(true),
255 }), // constants list,
256 std::vector<c10::TypePtr>({
257 c10::parseType("float"),
258 }), // types list,
259 4
260 ),
261 std::vector<OperatorString>({
262 OperatorString({"aten::is_floating_point", "", 1}),
263 OperatorString({"aten::div_", "Scalar", 2}),
264 OperatorString({"prim::unchecked_cast", "", 1}),
265 OperatorString({"aten::div_", "Scalar_mode", 3}),
266 }), // operators list
267 }),
268 ByteCodeFunctionWithOperator({
269 mobile::Function::registerFunc(
270 "div__Scalar_mode_0_3",
271 std::vector<Instruction>({
272 Instruction{OpCode::STOREN, 1, 3},
273 Instruction{OpCode::MOVE, 1, 0},
274 Instruction{OpCode::MOVE, 2, 0},
275 Instruction{OpCode::MOVE, 3, 0},
276 Instruction{OpCode::OP, 0, 0},
277 Instruction{OpCode::RET, 0, 0},
278 }), // instructions list,
279 std::vector<c10::IValue>(), // constants list,
280 std::vector<c10::TypePtr>(), // types list,
281 3
282 ),
283 std::vector<OperatorString>({
284 OperatorString({"aten::div_", "Scalar_mode", 3}),
285 }), // operators list
286 }),
287 ByteCodeFunctionWithOperator({
288 mobile::Function::registerFunc(
289 "div__Tensor_0_3",
290 std::vector<Instruction>({
291 Instruction{OpCode::STOREN, 1, 2},
292 Instruction{OpCode::LOAD, 1, 0},
293 Instruction{OpCode::OP, 0, 0},
294 Instruction{OpCode::JF, 3, 0},
295 Instruction{OpCode::LOADC, 1, 0},
296 Instruction{OpCode::JMP, 3, 0},
297 Instruction{OpCode::LOAD, 2, 0},
298 Instruction{OpCode::OP, 0, 0},
299 Instruction{OpCode::STORE, 3, 0},
300 Instruction{OpCode::MOVE, 3, 0},
301 Instruction{OpCode::JF, 5, 0},
302 Instruction{OpCode::LOAD, 1, 0},
303 Instruction{OpCode::LOAD, 2, 0},
304 Instruction{OpCode::OP, 1, 0},
305 Instruction{OpCode::JMP, 5, 0},
306 Instruction{OpCode::LOAD, 1, 0},
307 Instruction{OpCode::LOAD, 2, 0},
308 Instruction{OpCode::LOADC, 0, 0},
309 Instruction{OpCode::OP, 2, 0},
310 Instruction{OpCode::STORE, 4, 0},
311 Instruction{OpCode::DROPR, 2, 0},
312 Instruction{OpCode::DROPR, 1, 0},
313 Instruction{OpCode::MOVE, 4, 0},
314 Instruction{OpCode::RET, 0, 0},
315 }), // instructions list,
316 std::vector<c10::IValue>({
317 c10::IValue("trunc"),
318 c10::IValue(true),
319 }), // constants list,
320 std::vector<c10::TypePtr>(), // types list,
321 4
322 ),
323 std::vector<OperatorString>({
324 OperatorString({"aten::is_floating_point", "", 1}),
325 OperatorString({"aten::div_", "Tensor", 2}),
326 OperatorString({"aten::div_", "Tensor_mode", 3}),
327 }), // operators list
328 }),
329 ByteCodeFunctionWithOperator({
330 mobile::Function::registerFunc(
331 "div__Tensor_mode_0_3",
332 std::vector<Instruction>({
333 Instruction{OpCode::STOREN, 1, 3},
334 Instruction{OpCode::MOVE, 1, 0},
335 Instruction{OpCode::MOVE, 2, 0},
336 Instruction{OpCode::MOVE, 3, 0},
337 Instruction{OpCode::OP, 0, 0},
338 Instruction{OpCode::RET, 0, 0},
339 }), // instructions list,
340 std::vector<c10::IValue>(), // constants list,
341 std::vector<c10::TypePtr>(), // types list,
342 3
343 ),
344 std::vector<OperatorString>({
345 OperatorString({"aten::div_", "Tensor_mode", 3}),
346 }), // operators list
347 }),
348 ByteCodeFunctionWithOperator({
349 mobile::Function::registerFunc(
350 "div_out_0_3",
351 std::vector<Instruction>({
352 Instruction{OpCode::STOREN, 1, 3},
353 Instruction{OpCode::LOAD, 1, 0},
354 Instruction{OpCode::OP, 0, 0},
355 Instruction{OpCode::JF, 3, 0},
356 Instruction{OpCode::LOADC, 1, 0},
357 Instruction{OpCode::JMP, 3, 0},
358 Instruction{OpCode::LOAD, 2, 0},
359 Instruction{OpCode::OP, 0, 0},
360 Instruction{OpCode::JF, 3, 0},
361 Instruction{OpCode::LOADC, 1, 0},
362 Instruction{OpCode::JMP, 3, 0},
363 Instruction{OpCode::LOAD, 3, 0},
364 Instruction{OpCode::OP, 0, 0},
365 Instruction{OpCode::STORE, 4, 0},
366 Instruction{OpCode::MOVE, 4, 0},
367 Instruction{OpCode::JF, 6, 0},
368 Instruction{OpCode::LOAD, 1, 0},
369 Instruction{OpCode::LOAD, 2, 0},
370 Instruction{OpCode::LOAD, 3, 0},
371 Instruction{OpCode::OP, 1, 0},
372 Instruction{OpCode::JMP, 6, 0},
373 Instruction{OpCode::LOAD, 1, 0},
374 Instruction{OpCode::LOAD, 2, 0},
375 Instruction{OpCode::LOADC, 0, 0},
376 Instruction{OpCode::LOAD, 3, 0},
377 Instruction{OpCode::OP, 2, 0},
378 Instruction{OpCode::STORE, 5, 0},
379 Instruction{OpCode::DROPR, 3, 0},
380 Instruction{OpCode::DROPR, 2, 0},
381 Instruction{OpCode::DROPR, 1, 0},
382 Instruction{OpCode::MOVE, 5, 0},
383 Instruction{OpCode::RET, 0, 0},
384 }), // instructions list,
385 std::vector<c10::IValue>({
386 c10::IValue("trunc"),
387 c10::IValue(true),
388 }), // constants list,
389 std::vector<c10::TypePtr>(), // types list,
390 5
391 ),
392 std::vector<OperatorString>({
393 OperatorString({"aten::is_floating_point", "", 1}),
394 OperatorString({"aten::div", "out", 3}),
395 OperatorString({"aten::div", "out_mode", 4}),
396 }), // operators list
397 }),
398 ByteCodeFunctionWithOperator({
399 mobile::Function::registerFunc(
400 "div_out_mode_0_3",
401 std::vector<Instruction>({
402 Instruction{OpCode::STOREN, 1, 4},
403 Instruction{OpCode::MOVE, 1, 0},
404 Instruction{OpCode::MOVE, 2, 0},
405 Instruction{OpCode::MOVE, 3, 0},
406 Instruction{OpCode::MOVE, 4, 0},
407 Instruction{OpCode::OP, 0, 0},
408 Instruction{OpCode::RET, 0, 0},
409 }), // instructions list,
410 std::vector<c10::IValue>(), // constants list,
411 std::vector<c10::TypePtr>(), // types list,
412 4
413 ),
414 std::vector<OperatorString>({
415 OperatorString({"aten::div", "out_mode", 4}),
416 }), // operators list
417 }),
418 ByteCodeFunctionWithOperator({
419 mobile::Function::registerFunc(
420 "full_names_0_4",
421 std::vector<Instruction>({
422 Instruction{OpCode::STOREN, 1, 7},
423 Instruction{OpCode::MOVE, 1, 0},
424 Instruction{OpCode::MOVE, 2, 0},
425 Instruction{OpCode::MOVE, 3, 0},
426 Instruction{OpCode::MOVE, 4, 0},
427 Instruction{OpCode::MOVE, 5, 0},
428 Instruction{OpCode::MOVE, 6, 0},
429 Instruction{OpCode::MOVE, 7, 0},
430 Instruction{OpCode::OP, 0, 0},
431 Instruction{OpCode::RET, 0, 0},
432 }), // instructions list,
433 std::vector<c10::IValue>(), // constants list,
434 std::vector<c10::TypePtr>(), // types list,
435 7
436 ),
437 std::vector<OperatorString>({
438 OperatorString({"aten::full", "names", 7}),
439 }), // operators list
440 }),
441 ByteCodeFunctionWithOperator({
442 mobile::Function::registerFunc(
443 "gelu_0_9",
444 std::vector<Instruction>({
445 Instruction{OpCode::STORE, 1, 0},
446 Instruction{OpCode::MOVE, 1, 0},
447 Instruction{OpCode::OP, 0, 0},
448 Instruction{OpCode::RET, 0, 0},
449 }), // instructions list,
450 std::vector<c10::IValue>({
451 c10::IValue("none"),
452 }), // constants list,
453 std::vector<c10::TypePtr>(), // types list,
454 1
455 ),
456 std::vector<OperatorString>({
457 OperatorString({"aten::gelu", "", 1}),
458 }), // operators list
459 }),
460 ByteCodeFunctionWithOperator({
461 mobile::Function::registerFunc(
462 "gelu_out_0_9",
463 std::vector<Instruction>({
464 Instruction{OpCode::STOREN, 1, 2},
465 Instruction{OpCode::MOVE, 1, 0},
466 Instruction{OpCode::MOVE, 2, 0},
467 Instruction{OpCode::OP, 0, 0},
468 Instruction{OpCode::RET, 0, 0},
469 }), // instructions list,
470 std::vector<c10::IValue>({
471 c10::IValue("none"),
472 }), // constants list,
473 std::vector<c10::TypePtr>(), // types list,
474 2
475 ),
476 std::vector<OperatorString>({
477 OperatorString({"aten::gelu", "out", 2}),
478 }), // operators list
479 }),
480 ByteCodeFunctionWithOperator({
481 mobile::Function::registerFunc(
482 "linspace_0_7",
483 std::vector<Instruction>({
484 Instruction{OpCode::STOREN, 1, 7},
485 Instruction{OpCode::LOAD, 3, 0},
486 Instruction{OpCode::LOADC, 0, 0},
487 Instruction{OpCode::__IS__, 0, 0},
488 Instruction{OpCode::JF, 10, 0},
489 Instruction{OpCode::LOAD, 1, 0},
490 Instruction{OpCode::LOAD, 2, 0},
491 Instruction{OpCode::LOADC, 1, 0},
492 Instruction{OpCode::LOAD, 4, 0},
493 Instruction{OpCode::LOAD, 5, 0},
494 Instruction{OpCode::LOAD, 6, 0},
495 Instruction{OpCode::LOAD, 7, 0},
496 Instruction{OpCode::OP, 0, 0},
497 Instruction{OpCode::JMP, 10, 0},
498 Instruction{OpCode::LOAD, 1, 0},
499 Instruction{OpCode::LOAD, 2, 0},
500 Instruction{OpCode::LOAD, 3, 0},
501 Instruction{OpCode::OP, 1, 0},
502 Instruction{OpCode::LOAD, 4, 0},
503 Instruction{OpCode::LOAD, 5, 0},
504 Instruction{OpCode::LOAD, 6, 0},
505 Instruction{OpCode::LOAD, 7, 0},
506 Instruction{OpCode::OP, 0, 0},
507 Instruction{OpCode::STORE, 8, 0},
508 Instruction{OpCode::DROPR, 7, 0},
509 Instruction{OpCode::DROPR, 6, 0},
510 Instruction{OpCode::DROPR, 5, 0},
511 Instruction{OpCode::DROPR, 4, 0},
512 Instruction{OpCode::DROPR, 2, 0},
513 Instruction{OpCode::DROPR, 1, 0},
514 Instruction{OpCode::DROPR, 3, 0},
515 Instruction{OpCode::MOVE, 8, 0},
516 Instruction{OpCode::RET, 0, 0},
517 }), // instructions list,
518 std::vector<c10::IValue>({
519 c10::IValue(),
520 c10::IValue(100),
521 }), // constants list,
522 std::vector<c10::TypePtr>(), // types list,
523 8
524 ),
525 std::vector<OperatorString>({
526 OperatorString({"aten::linspace", "", 7}),
527 OperatorString({"prim::unchecked_cast", "", 1}),
528 }), // operators list
529 }),
530 ByteCodeFunctionWithOperator({
531 mobile::Function::registerFunc(
532 "linspace_out_0_7",
533 std::vector<Instruction>({
534 Instruction{OpCode::STOREN, 1, 4},
535 Instruction{OpCode::LOAD, 3, 0},
536 Instruction{OpCode::LOADC, 0, 0},
537 Instruction{OpCode::__IS__, 0, 0},
538 Instruction{OpCode::JF, 7, 0},
539 Instruction{OpCode::LOAD, 1, 0},
540 Instruction{OpCode::LOAD, 2, 0},
541 Instruction{OpCode::LOADC, 1, 0},
542 Instruction{OpCode::LOAD, 4, 0},
543 Instruction{OpCode::OP, 0, 0},
544 Instruction{OpCode::JMP, 7, 0},
545 Instruction{OpCode::LOAD, 1, 0},
546 Instruction{OpCode::LOAD, 2, 0},
547 Instruction{OpCode::LOAD, 3, 0},
548 Instruction{OpCode::OP, 1, 0},
549 Instruction{OpCode::LOAD, 4, 0},
550 Instruction{OpCode::OP, 0, 0},
551 Instruction{OpCode::STORE, 5, 0},
552 Instruction{OpCode::DROPR, 4, 0},
553 Instruction{OpCode::DROPR, 2, 0},
554 Instruction{OpCode::DROPR, 1, 0},
555 Instruction{OpCode::DROPR, 3, 0},
556 Instruction{OpCode::MOVE, 5, 0},
557 Instruction{OpCode::RET, 0, 0},
558 }), // instructions list,
559 std::vector<c10::IValue>({
560 c10::IValue(),
561 c10::IValue(100),
562 }), // constants list,
563 std::vector<c10::TypePtr>(), // types list,
564 5
565 ),
566 std::vector<OperatorString>({
567 OperatorString({"aten::linspace", "out", 4}),
568 OperatorString({"prim::unchecked_cast", "", 1}),
569 }), // operators list
570 }),
571 ByteCodeFunctionWithOperator({
572 mobile::Function::registerFunc(
573 "logspace_0_8",
574 std::vector<Instruction>({
575 Instruction{OpCode::STOREN, 1, 8},
576 Instruction{OpCode::LOAD, 3, 0},
577 Instruction{OpCode::LOADC, 0, 0},
578 Instruction{OpCode::__IS__, 0, 0},
579 Instruction{OpCode::JF, 11, 0},
580 Instruction{OpCode::LOAD, 1, 0},
581 Instruction{OpCode::LOAD, 2, 0},
582 Instruction{OpCode::LOADC, 1, 0},
583 Instruction{OpCode::LOAD, 4, 0},
584 Instruction{OpCode::LOAD, 5, 0},
585 Instruction{OpCode::LOAD, 6, 0},
586 Instruction{OpCode::LOAD, 7, 0},
587 Instruction{OpCode::LOAD, 8, 0},
588 Instruction{OpCode::OP, 0, 0},
589 Instruction{OpCode::JMP, 11, 0},
590 Instruction{OpCode::LOAD, 1, 0},
591 Instruction{OpCode::LOAD, 2, 0},
592 Instruction{OpCode::LOAD, 3, 0},
593 Instruction{OpCode::OP, 1, 0},
594 Instruction{OpCode::LOAD, 4, 0},
595 Instruction{OpCode::LOAD, 5, 0},
596 Instruction{OpCode::LOAD, 6, 0},
597 Instruction{OpCode::LOAD, 7, 0},
598 Instruction{OpCode::LOAD, 8, 0},
599 Instruction{OpCode::OP, 0, 0},
600 Instruction{OpCode::STORE, 9, 0},
601 Instruction{OpCode::DROPR, 8, 0},
602 Instruction{OpCode::DROPR, 7, 0},
603 Instruction{OpCode::DROPR, 6, 0},
604 Instruction{OpCode::DROPR, 5, 0},
605 Instruction{OpCode::DROPR, 4, 0},
606 Instruction{OpCode::DROPR, 2, 0},
607 Instruction{OpCode::DROPR, 1, 0},
608 Instruction{OpCode::DROPR, 3, 0},
609 Instruction{OpCode::MOVE, 9, 0},
610 Instruction{OpCode::RET, 0, 0},
611 }), // instructions list,
612 std::vector<c10::IValue>({
613 c10::IValue(),
614 c10::IValue(100),
615 }), // constants list,
616 std::vector<c10::TypePtr>(), // types list,
617 9
618 ),
619 std::vector<OperatorString>({
620 OperatorString({"aten::logspace", "", 8}),
621 OperatorString({"prim::unchecked_cast", "", 1}),
622 }), // operators list
623 }),
624 ByteCodeFunctionWithOperator({
625 mobile::Function::registerFunc(
626 "logspace_out_0_8",
627 std::vector<Instruction>({
628 Instruction{OpCode::STOREN, 1, 5},
629 Instruction{OpCode::LOAD, 3, 0},
630 Instruction{OpCode::LOADC, 0, 0},
631 Instruction{OpCode::__IS__, 0, 0},
632 Instruction{OpCode::JF, 8, 0},
633 Instruction{OpCode::LOAD, 1, 0},
634 Instruction{OpCode::LOAD, 2, 0},
635 Instruction{OpCode::LOADC, 1, 0},
636 Instruction{OpCode::LOAD, 4, 0},
637 Instruction{OpCode::LOAD, 5, 0},
638 Instruction{OpCode::OP, 0, 0},
639 Instruction{OpCode::JMP, 8, 0},
640 Instruction{OpCode::LOAD, 1, 0},
641 Instruction{OpCode::LOAD, 2, 0},
642 Instruction{OpCode::LOAD, 3, 0},
643 Instruction{OpCode::OP, 1, 0},
644 Instruction{OpCode::LOAD, 4, 0},
645 Instruction{OpCode::LOAD, 5, 0},
646 Instruction{OpCode::OP, 0, 0},
647 Instruction{OpCode::STORE, 6, 0},
648 Instruction{OpCode::DROPR, 5, 0},
649 Instruction{OpCode::DROPR, 4, 0},
650 Instruction{OpCode::DROPR, 2, 0},
651 Instruction{OpCode::DROPR, 1, 0},
652 Instruction{OpCode::DROPR, 3, 0},
653 Instruction{OpCode::MOVE, 6, 0},
654 Instruction{OpCode::RET, 0, 0},
655 }), // instructions list,
656 std::vector<c10::IValue>({
657 c10::IValue(),
658 c10::IValue(100),
659 }), // constants list,
660 std::vector<c10::TypePtr>(), // types list,
661 6
662 ),
663 std::vector<OperatorString>({
664 OperatorString({"aten::logspace", "out", 5}),
665 OperatorString({"prim::unchecked_cast", "", 1}),
666 }), // operators list
667 }),
668 });
669 for (const auto& upgrader_function : upgrader_function_list) {
670 for (const auto& op : upgrader_function.operators) {
671 upgrader_function.function.append_operator(
672 op.name,
673 op.overload_name,
674 op.num_specified_args);
675 }
676 }
677 return upgrader_function_list;
678 };
679 static std::vector<ByteCodeFunctionWithOperator> upgraderBytecodeList =
680 generate_upgrader_bytecode_list();
681 return upgraderBytecodeList;
682 }
683
684 // clang-format on
685
686 } // namespace torch::jit
687