pytorch

Форк
0
/
upgrader_mobile.cpp 
688 строк · 41.3 Кб
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 {
16
namespace jit {
17

18
// clang-format off
19

20
// From operator_versions_map
21

22
const std::unordered_map<std::string, std::vector<Upgrader>>
23
getOperatorVersionMapForMobile() {
24
  static std::unordered_map<std::string, std::vector<Upgrader>>
25
        operatorVersionMapForMobile({
26
                {std::string("aten::div.Scalar"),
27
                    std::vector<Upgrader>({
28
                        Upgrader({0, 3, "div_Scalar_0_3", 0})
29
                    })},
30
                {std::string("aten::div.Scalar_mode"),
31
                    std::vector<Upgrader>({
32
                        Upgrader({0, 3, "div_Scalar_mode_0_3", 1})
33
                    })},
34
                {std::string("aten::div.Tensor"),
35
                    std::vector<Upgrader>({
36
                        Upgrader({0, 3, "div_Tensor_0_3", 2})
37
                    })},
38
                {std::string("aten::div.Tensor_mode"),
39
                    std::vector<Upgrader>({
40
                        Upgrader({0, 3, "div_Tensor_mode_0_3", 3})
41
                    })},
42
                {std::string("aten::div.out"),
43
                    std::vector<Upgrader>({
44
                        Upgrader({0, 3, "div_out_0_3", 8})
45
                    })},
46
                {std::string("aten::div.out_mode"),
47
                    std::vector<Upgrader>({
48
                        Upgrader({0, 3, "div_out_mode_0_3", 9})
49
                    })},
50
                {std::string("aten::div_.Scalar"),
51
                    std::vector<Upgrader>({
52
                        Upgrader({0, 3, "div__Scalar_0_3", 4})
53
                    })},
54
                {std::string("aten::div_.Scalar_mode"),
55
                    std::vector<Upgrader>({
56
                        Upgrader({0, 3, "div__Scalar_mode_0_3", 5})
57
                    })},
58
                {std::string("aten::div_.Tensor"),
59
                    std::vector<Upgrader>({
60
                        Upgrader({0, 3, "div__Tensor_0_3", 6})
61
                    })},
62
                {std::string("aten::div_.Tensor_mode"),
63
                    std::vector<Upgrader>({
64
                        Upgrader({0, 3, "div__Tensor_mode_0_3", 7})
65
                    })},
66
                {std::string("aten::gelu"),
67
                    std::vector<Upgrader>({
68
                        Upgrader({0, 9, "gelu_0_9", 11})
69
                    })},
70
                {std::string("aten::gelu.out"),
71
                    std::vector<Upgrader>({
72
                        Upgrader({0, 9, "gelu_out_0_9", 12})
73
                    })},
74
                {std::string("aten::linspace"),
75
                    std::vector<Upgrader>({
76
                        Upgrader({0, 7, "linspace_0_7", 13})
77
                    })},
78
                {std::string("aten::linspace.out"),
79
                    std::vector<Upgrader>({
80
                        Upgrader({0, 7, "linspace_out_0_7", 14})
81
                    })},
82
                {std::string("aten::logspace"),
83
                    std::vector<Upgrader>({
84
                        Upgrader({0, 8, "logspace_0_8", 15})
85
                    })},
86
                {std::string("aten::logspace.out"),
87
                    std::vector<Upgrader>({
88
                        Upgrader({0, 8, "logspace_out_0_8", 16})
89
                    })},
90
      });
91
  return operatorVersionMapForMobile;
92
}
93

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

685
// clang-format on
686

687
} // namespace jit
688
} // namespace torch
689

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.