torch-rb 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +5 -3
  4. data/ext/torch/ext.cpp +22 -548
  5. data/ext/torch/extconf.rb +6 -0
  6. data/ext/torch/nn_functions.cpp +595 -0
  7. data/ext/torch/nn_functions.hpp +6 -0
  8. data/ext/torch/templates.hpp +250 -0
  9. data/ext/torch/tensor_functions.cpp +1860 -0
  10. data/ext/torch/tensor_functions.hpp +6 -0
  11. data/ext/torch/torch_functions.cpp +2875 -0
  12. data/ext/torch/torch_functions.hpp +6 -0
  13. data/lib/torch.rb +68 -129
  14. data/lib/torch/ext.bundle +0 -0
  15. data/lib/torch/native/dispatcher.rb +48 -0
  16. data/lib/torch/native/function.rb +78 -0
  17. data/lib/torch/native/generator.rb +149 -0
  18. data/lib/torch/native/native_functions.yaml +6837 -0
  19. data/lib/torch/native/parser.rb +97 -0
  20. data/lib/torch/nn/bce_with_logits_loss.rb +15 -0
  21. data/lib/torch/nn/conv2d.rb +0 -2
  22. data/lib/torch/nn/cosine_embedding_loss.rb +14 -0
  23. data/lib/torch/nn/functional.rb +55 -16
  24. data/lib/torch/nn/hinge_embedding_loss.rb +14 -0
  25. data/lib/torch/nn/identity.rb +1 -0
  26. data/lib/torch/nn/margin_ranking_loss.rb +14 -0
  27. data/lib/torch/nn/module.rb +59 -12
  28. data/lib/torch/nn/multi_label_margin_loss.rb +13 -0
  29. data/lib/torch/nn/multi_label_soft_margin_loss.rb +13 -0
  30. data/lib/torch/nn/multi_margin_loss.rb +17 -0
  31. data/lib/torch/nn/parameter.rb +4 -0
  32. data/lib/torch/nn/rnn.rb +22 -0
  33. data/lib/torch/nn/rnn_base.rb +154 -0
  34. data/lib/torch/nn/smooth_l1_loss.rb +13 -0
  35. data/lib/torch/nn/soft_margin_loss.rb +13 -0
  36. data/lib/torch/nn/triplet_margin_loss.rb +18 -0
  37. data/lib/torch/tensor.rb +19 -19
  38. data/lib/torch/version.rb +1 -1
  39. metadata +26 -2
@@ -0,0 +1,6 @@
1
+ // generated by rake generate:functions
2
+ // do not edit by hand
3
+
4
+ #pragma once
5
+
6
+ void add_tensor_functions(Module m);
@@ -0,0 +1,2875 @@
1
+ // generated by rake generate:functions
2
+ // do not edit by hand
3
+
4
+ #include <torch/torch.h>
5
+ #include <rice/Module.hpp>
6
+ #include "templates.hpp"
7
+
8
+ void add_torch_functions(Module m) {
9
+ m
10
+ .define_singleton_method(
11
+ "_abs",
12
+ *[](const Tensor &self) {
13
+ return torch::abs(self);
14
+ })
15
+ .define_singleton_method(
16
+ "_abs_",
17
+ *[](Tensor &self) {
18
+ return torch::abs_(self);
19
+ })
20
+ .define_singleton_method(
21
+ "_abs_out",
22
+ *[](const Tensor &self, Tensor &out) {
23
+ return torch::abs_out(out, self);
24
+ })
25
+ .define_singleton_method(
26
+ "_acos",
27
+ *[](const Tensor &self) {
28
+ return torch::acos(self);
29
+ })
30
+ .define_singleton_method(
31
+ "_acos_",
32
+ *[](Tensor &self) {
33
+ return torch::acos_(self);
34
+ })
35
+ .define_singleton_method(
36
+ "_acos_out",
37
+ *[](const Tensor &self, Tensor &out) {
38
+ return torch::acos_out(out, self);
39
+ })
40
+ .define_singleton_method(
41
+ "_adaptive_avg_pool1d",
42
+ *[](const Tensor &self, IntArrayRef output_size) {
43
+ return torch::adaptive_avg_pool1d(self, output_size);
44
+ })
45
+ .define_singleton_method(
46
+ "_adaptive_max_pool1d",
47
+ *[](const Tensor &self, IntArrayRef output_size) {
48
+ return torch::adaptive_max_pool1d(self, output_size);
49
+ })
50
+ .define_singleton_method(
51
+ "_add_out",
52
+ *[](const Tensor &self, const Tensor &other, Scalar alpha, Tensor &out) {
53
+ return torch::add_out(out, self, other, alpha);
54
+ })
55
+ .define_singleton_method(
56
+ "_add_scalar",
57
+ *[](const Tensor &self, Scalar other, Scalar alpha) {
58
+ return torch::add(self, other, alpha);
59
+ })
60
+ .define_singleton_method(
61
+ "_add_tensor",
62
+ *[](const Tensor &self, const Tensor &other, Scalar alpha) {
63
+ return torch::add(self, other, alpha);
64
+ })
65
+ .define_singleton_method(
66
+ "_addbmm",
67
+ *[](const Tensor &self, const Tensor &batch1, const Tensor &batch2, Scalar beta, Scalar alpha) {
68
+ return torch::addbmm(self, batch1, batch2, beta, alpha);
69
+ })
70
+ .define_singleton_method(
71
+ "_addbmm_out",
72
+ *[](const Tensor &self, const Tensor &batch1, const Tensor &batch2, Scalar beta, Scalar alpha, Tensor &out) {
73
+ return torch::addbmm_out(out, self, batch1, batch2, beta, alpha);
74
+ })
75
+ .define_singleton_method(
76
+ "_addcdiv",
77
+ *[](const Tensor &self, const Tensor &tensor1, const Tensor &tensor2, Scalar value) {
78
+ return torch::addcdiv(self, tensor1, tensor2, value);
79
+ })
80
+ .define_singleton_method(
81
+ "_addcdiv_out",
82
+ *[](const Tensor &self, const Tensor &tensor1, const Tensor &tensor2, Scalar value, Tensor &out) {
83
+ return torch::addcdiv_out(out, self, tensor1, tensor2, value);
84
+ })
85
+ .define_singleton_method(
86
+ "_addcmul",
87
+ *[](const Tensor &self, const Tensor &tensor1, const Tensor &tensor2, Scalar value) {
88
+ return torch::addcmul(self, tensor1, tensor2, value);
89
+ })
90
+ .define_singleton_method(
91
+ "_addcmul_out",
92
+ *[](const Tensor &self, const Tensor &tensor1, const Tensor &tensor2, Scalar value, Tensor &out) {
93
+ return torch::addcmul_out(out, self, tensor1, tensor2, value);
94
+ })
95
+ .define_singleton_method(
96
+ "_addmm",
97
+ *[](const Tensor &self, const Tensor &mat1, const Tensor &mat2, Scalar beta, Scalar alpha) {
98
+ return torch::addmm(self, mat1, mat2, beta, alpha);
99
+ })
100
+ .define_singleton_method(
101
+ "_addmm_out",
102
+ *[](const Tensor &self, const Tensor &mat1, const Tensor &mat2, Scalar beta, Scalar alpha, Tensor &out) {
103
+ return torch::addmm_out(out, self, mat1, mat2, beta, alpha);
104
+ })
105
+ .define_singleton_method(
106
+ "_addmv",
107
+ *[](const Tensor &self, const Tensor &mat, const Tensor &vec, Scalar beta, Scalar alpha) {
108
+ return torch::addmv(self, mat, vec, beta, alpha);
109
+ })
110
+ .define_singleton_method(
111
+ "_addmv_",
112
+ *[](Tensor &self, const Tensor &mat, const Tensor &vec, Scalar beta, Scalar alpha) {
113
+ return torch::addmv_(self, mat, vec, beta, alpha);
114
+ })
115
+ .define_singleton_method(
116
+ "_addmv_out",
117
+ *[](const Tensor &self, const Tensor &mat, const Tensor &vec, Scalar beta, Scalar alpha, Tensor &out) {
118
+ return torch::addmv_out(out, self, mat, vec, beta, alpha);
119
+ })
120
+ .define_singleton_method(
121
+ "_addr",
122
+ *[](const Tensor &self, const Tensor &vec1, const Tensor &vec2, Scalar beta, Scalar alpha) {
123
+ return torch::addr(self, vec1, vec2, beta, alpha);
124
+ })
125
+ .define_singleton_method(
126
+ "_addr_out",
127
+ *[](const Tensor &self, const Tensor &vec1, const Tensor &vec2, Scalar beta, Scalar alpha, Tensor &out) {
128
+ return torch::addr_out(out, self, vec1, vec2, beta, alpha);
129
+ })
130
+ .define_singleton_method(
131
+ "_affine_grid_generator",
132
+ *[](const Tensor &theta, IntArrayRef size, bool align_corners) {
133
+ return torch::affine_grid_generator(theta, size, align_corners);
134
+ })
135
+ .define_singleton_method(
136
+ "_alias",
137
+ *[](Tensor &self) {
138
+ return torch::alias(self);
139
+ })
140
+ .define_singleton_method(
141
+ "_align_tensors",
142
+ *[](TensorList tensors) {
143
+ return torch::align_tensors(tensors);
144
+ })
145
+ .define_singleton_method(
146
+ "_all",
147
+ *[](const Tensor &self) {
148
+ return torch::all(self);
149
+ })
150
+ .define_singleton_method(
151
+ "_all_dim",
152
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
153
+ return torch::all(self, dim, keepdim);
154
+ })
155
+ .define_singleton_method(
156
+ "_all_out",
157
+ *[](const Tensor &self, int64_t dim, bool keepdim, Tensor &out) {
158
+ return torch::all_out(out, self, dim, keepdim);
159
+ })
160
+ .define_singleton_method(
161
+ "_allclose",
162
+ *[](const Tensor &self, const Tensor &other, double rtol, double atol, bool equal_nan) {
163
+ return torch::allclose(self, other, rtol, atol, equal_nan);
164
+ })
165
+ .define_singleton_method(
166
+ "_alpha_dropout",
167
+ *[](const Tensor &input, double p, bool train) {
168
+ return torch::alpha_dropout(input, p, train);
169
+ })
170
+ .define_singleton_method(
171
+ "_alpha_dropout_",
172
+ *[](Tensor &self, double p, bool train) {
173
+ return torch::alpha_dropout_(self, p, train);
174
+ })
175
+ .define_singleton_method(
176
+ "_any",
177
+ *[](const Tensor &self) {
178
+ return torch::any(self);
179
+ })
180
+ .define_singleton_method(
181
+ "_any_dim",
182
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
183
+ return torch::any(self, dim, keepdim);
184
+ })
185
+ .define_singleton_method(
186
+ "_any_out",
187
+ *[](const Tensor &self, int64_t dim, bool keepdim, Tensor &out) {
188
+ return torch::any_out(out, self, dim, keepdim);
189
+ })
190
+ .define_singleton_method(
191
+ "_arange_out",
192
+ *[](Scalar end, Tensor &out) {
193
+ return torch::arange_out(out, end);
194
+ })
195
+ .define_singleton_method(
196
+ "_arange_start_out",
197
+ *[](Scalar start, Scalar end, Scalar step, Tensor &out) {
198
+ return torch::arange_out(out, start, end, step);
199
+ })
200
+ .define_singleton_method(
201
+ "_argmax",
202
+ *[](const Tensor &self) {
203
+ return torch::argmax(self);
204
+ })
205
+ .define_singleton_method(
206
+ "_argmax_dim",
207
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
208
+ return torch::argmax(self, dim, keepdim);
209
+ })
210
+ .define_singleton_method(
211
+ "_argmin",
212
+ *[](const Tensor &self) {
213
+ return torch::argmin(self);
214
+ })
215
+ .define_singleton_method(
216
+ "_argmin_dim",
217
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
218
+ return torch::argmin(self, dim, keepdim);
219
+ })
220
+ .define_singleton_method(
221
+ "_argsort",
222
+ *[](const Tensor &self, int64_t dim, bool descending) {
223
+ return torch::argsort(self, dim, descending);
224
+ })
225
+ .define_singleton_method(
226
+ "_as_strided",
227
+ *[](Tensor &self, IntArrayRef size, IntArrayRef stride) {
228
+ return torch::as_strided(self, size, stride);
229
+ })
230
+ .define_singleton_method(
231
+ "_as_strided_",
232
+ *[](Tensor &self, IntArrayRef size, IntArrayRef stride) {
233
+ return torch::as_strided_(self, size, stride);
234
+ })
235
+ .define_singleton_method(
236
+ "_as_strided__storage_offset",
237
+ *[](Tensor &self, IntArrayRef size, IntArrayRef stride, int64_t storage_offset) {
238
+ return torch::as_strided_(self, size, stride, storage_offset);
239
+ })
240
+ .define_singleton_method(
241
+ "_as_strided_storage_offset",
242
+ *[](Tensor &self, IntArrayRef size, IntArrayRef stride, int64_t storage_offset) {
243
+ return torch::as_strided(self, size, stride, storage_offset);
244
+ })
245
+ .define_singleton_method(
246
+ "_asin",
247
+ *[](const Tensor &self) {
248
+ return torch::asin(self);
249
+ })
250
+ .define_singleton_method(
251
+ "_asin_",
252
+ *[](Tensor &self) {
253
+ return torch::asin_(self);
254
+ })
255
+ .define_singleton_method(
256
+ "_asin_out",
257
+ *[](const Tensor &self, Tensor &out) {
258
+ return torch::asin_out(out, self);
259
+ })
260
+ .define_singleton_method(
261
+ "_atan",
262
+ *[](const Tensor &self) {
263
+ return torch::atan(self);
264
+ })
265
+ .define_singleton_method(
266
+ "_atan2",
267
+ *[](const Tensor &self, const Tensor &other) {
268
+ return torch::atan2(self, other);
269
+ })
270
+ .define_singleton_method(
271
+ "_atan2_out",
272
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
273
+ return torch::atan2_out(out, self, other);
274
+ })
275
+ .define_singleton_method(
276
+ "_atan_",
277
+ *[](Tensor &self) {
278
+ return torch::atan_(self);
279
+ })
280
+ .define_singleton_method(
281
+ "_atan_out",
282
+ *[](const Tensor &self, Tensor &out) {
283
+ return torch::atan_out(out, self);
284
+ })
285
+ .define_singleton_method(
286
+ "_avg_pool1d",
287
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, bool ceil_mode, bool count_include_pad) {
288
+ return torch::avg_pool1d(self, kernel_size, stride, padding, ceil_mode, count_include_pad);
289
+ })
290
+ .define_singleton_method(
291
+ "_baddbmm",
292
+ *[](const Tensor &self, const Tensor &batch1, const Tensor &batch2, Scalar beta, Scalar alpha) {
293
+ return torch::baddbmm(self, batch1, batch2, beta, alpha);
294
+ })
295
+ .define_singleton_method(
296
+ "_baddbmm_out",
297
+ *[](const Tensor &self, const Tensor &batch1, const Tensor &batch2, Scalar beta, Scalar alpha, Tensor &out) {
298
+ return torch::baddbmm_out(out, self, batch1, batch2, beta, alpha);
299
+ })
300
+ .define_singleton_method(
301
+ "_batch_norm",
302
+ *[](const Tensor &input, OptionalTensor weight, OptionalTensor bias, OptionalTensor running_mean, OptionalTensor running_var, bool training, double momentum, double eps, bool cudnn_enabled) {
303
+ return torch::batch_norm(input, weight, bias, running_mean, running_var, training, momentum, eps, cudnn_enabled);
304
+ })
305
+ .define_singleton_method(
306
+ "_batch_norm_backward_elemt",
307
+ *[](const Tensor &grad_out, const Tensor &input, const Tensor &mean, const Tensor &invstd, OptionalTensor weight, const Tensor &mean_dy, const Tensor &mean_dy_xmu) {
308
+ return torch::batch_norm_backward_elemt(grad_out, input, mean, invstd, weight, mean_dy, mean_dy_xmu);
309
+ })
310
+ .define_singleton_method(
311
+ "_batch_norm_backward_reduce",
312
+ *[](const Tensor &grad_out, const Tensor &input, const Tensor &mean, const Tensor &invstd, OptionalTensor weight, bool input_g, bool weight_g, bool bias_g) {
313
+ return torch::batch_norm_backward_reduce(grad_out, input, mean, invstd, weight, input_g, weight_g, bias_g);
314
+ })
315
+ .define_singleton_method(
316
+ "_batch_norm_elemt",
317
+ *[](const Tensor &input, OptionalTensor weight, OptionalTensor bias, const Tensor &mean, const Tensor &invstd, double eps) {
318
+ return torch::batch_norm_elemt(input, weight, bias, mean, invstd, eps);
319
+ })
320
+ .define_singleton_method(
321
+ "_batch_norm_gather_stats",
322
+ *[](const Tensor &input, const Tensor &mean, const Tensor &invstd, OptionalTensor running_mean, OptionalTensor running_var, double momentum, double eps, int64_t count) {
323
+ return torch::batch_norm_gather_stats(input, mean, invstd, running_mean, running_var, momentum, eps, count);
324
+ })
325
+ .define_singleton_method(
326
+ "_batch_norm_gather_stats_with_counts",
327
+ *[](const Tensor &input, const Tensor &mean, const Tensor &invstd, OptionalTensor running_mean, OptionalTensor running_var, double momentum, double eps, IntArrayRef counts) {
328
+ return torch::batch_norm_gather_stats_with_counts(input, mean, invstd, running_mean, running_var, momentum, eps, counts);
329
+ })
330
+ .define_singleton_method(
331
+ "_batch_norm_stats",
332
+ *[](const Tensor &input, double eps) {
333
+ return torch::batch_norm_stats(input, eps);
334
+ })
335
+ .define_singleton_method(
336
+ "_batch_norm_update_stats",
337
+ *[](const Tensor &input, OptionalTensor running_mean, OptionalTensor running_var, double momentum) {
338
+ return torch::batch_norm_update_stats(input, running_mean, running_var, momentum);
339
+ })
340
+ .define_singleton_method(
341
+ "_bernoulli",
342
+ *[](const Tensor &self) {
343
+ return torch::bernoulli(self);
344
+ })
345
+ .define_singleton_method(
346
+ "_bernoulli_out",
347
+ *[](const Tensor &self, Tensor &out) {
348
+ return torch::bernoulli_out(out, self);
349
+ })
350
+ .define_singleton_method(
351
+ "_bernoulli_p",
352
+ *[](const Tensor &self, double p) {
353
+ return torch::bernoulli(self, p);
354
+ })
355
+ .define_singleton_method(
356
+ "_bilinear",
357
+ *[](const Tensor &input1, const Tensor &input2, const Tensor &weight, OptionalTensor bias) {
358
+ return torch::bilinear(input1, input2, weight, bias);
359
+ })
360
+ .define_singleton_method(
361
+ "_binary_cross_entropy_with_logits",
362
+ *[](const Tensor &self, const Tensor &target, OptionalTensor weight, OptionalTensor pos_weight, MyReduction reduction) {
363
+ return torch::binary_cross_entropy_with_logits(self, target, weight, pos_weight, reduction);
364
+ })
365
+ .define_singleton_method(
366
+ "_bincount",
367
+ *[](const Tensor &self, OptionalTensor weights, int64_t minlength) {
368
+ return torch::bincount(self, weights, minlength);
369
+ })
370
+ .define_singleton_method(
371
+ "_bitwise_not",
372
+ *[](const Tensor &self) {
373
+ return torch::bitwise_not(self);
374
+ })
375
+ .define_singleton_method(
376
+ "_bitwise_not_out",
377
+ *[](const Tensor &self, Tensor &out) {
378
+ return torch::bitwise_not_out(out, self);
379
+ })
380
+ .define_singleton_method(
381
+ "_bmm",
382
+ *[](const Tensor &self, const Tensor &mat2) {
383
+ return torch::bmm(self, mat2);
384
+ })
385
+ .define_singleton_method(
386
+ "_bmm_out",
387
+ *[](const Tensor &self, const Tensor &mat2, Tensor &out) {
388
+ return torch::bmm_out(out, self, mat2);
389
+ })
390
+ .define_singleton_method(
391
+ "_broadcast_tensors",
392
+ *[](TensorList tensors) {
393
+ return torch::broadcast_tensors(tensors);
394
+ })
395
+ .define_singleton_method(
396
+ "_cartesian_prod",
397
+ *[](TensorList tensors) {
398
+ return torch::cartesian_prod(tensors);
399
+ })
400
+ .define_singleton_method(
401
+ "_cat",
402
+ *[](TensorList tensors, int64_t dim) {
403
+ return torch::cat(tensors, dim);
404
+ })
405
+ .define_singleton_method(
406
+ "_cat_out",
407
+ *[](TensorList tensors, int64_t dim, Tensor &out) {
408
+ return torch::cat_out(out, tensors, dim);
409
+ })
410
+ .define_singleton_method(
411
+ "_cdist",
412
+ *[](const Tensor &x1, const Tensor &x2, double p) {
413
+ return torch::cdist(x1, x2, p);
414
+ })
415
+ .define_singleton_method(
416
+ "_ceil",
417
+ *[](const Tensor &self) {
418
+ return torch::ceil(self);
419
+ })
420
+ .define_singleton_method(
421
+ "_ceil_",
422
+ *[](Tensor &self) {
423
+ return torch::ceil_(self);
424
+ })
425
+ .define_singleton_method(
426
+ "_ceil_out",
427
+ *[](const Tensor &self, Tensor &out) {
428
+ return torch::ceil_out(out, self);
429
+ })
430
+ .define_singleton_method(
431
+ "_celu",
432
+ *[](const Tensor &self, Scalar alpha) {
433
+ return torch::celu(self, alpha);
434
+ })
435
+ .define_singleton_method(
436
+ "_celu_",
437
+ *[](Tensor &self, Scalar alpha) {
438
+ return torch::celu_(self, alpha);
439
+ })
440
+ .define_singleton_method(
441
+ "_chain_matmul",
442
+ *[](TensorList matrices) {
443
+ return torch::chain_matmul(matrices);
444
+ })
445
+ .define_singleton_method(
446
+ "_cholesky",
447
+ *[](const Tensor &self, bool upper) {
448
+ return torch::cholesky(self, upper);
449
+ })
450
+ .define_singleton_method(
451
+ "_cholesky_inverse",
452
+ *[](const Tensor &self, bool upper) {
453
+ return torch::cholesky_inverse(self, upper);
454
+ })
455
+ .define_singleton_method(
456
+ "_cholesky_inverse_out",
457
+ *[](const Tensor &self, bool upper, Tensor &out) {
458
+ return torch::cholesky_inverse_out(out, self, upper);
459
+ })
460
+ .define_singleton_method(
461
+ "_cholesky_out",
462
+ *[](const Tensor &self, bool upper, Tensor &out) {
463
+ return torch::cholesky_out(out, self, upper);
464
+ })
465
+ .define_singleton_method(
466
+ "_cholesky_solve",
467
+ *[](const Tensor &self, const Tensor &input2, bool upper) {
468
+ return torch::cholesky_solve(self, input2, upper);
469
+ })
470
+ .define_singleton_method(
471
+ "_cholesky_solve_out",
472
+ *[](const Tensor &self, const Tensor &input2, bool upper, Tensor &out) {
473
+ return torch::cholesky_solve_out(out, self, input2, upper);
474
+ })
475
+ .define_singleton_method(
476
+ "_chunk",
477
+ *[](Tensor &self, int64_t chunks, int64_t dim) {
478
+ return torch::chunk(self, chunks, dim);
479
+ })
480
+ .define_singleton_method(
481
+ "_clamp_max",
482
+ *[](const Tensor &self, Scalar max) {
483
+ return torch::clamp_max(self, max);
484
+ })
485
+ .define_singleton_method(
486
+ "_clamp_max_",
487
+ *[](Tensor &self, Scalar max) {
488
+ return torch::clamp_max_(self, max);
489
+ })
490
+ .define_singleton_method(
491
+ "_clamp_max_out",
492
+ *[](const Tensor &self, Scalar max, Tensor &out) {
493
+ return torch::clamp_max_out(out, self, max);
494
+ })
495
+ .define_singleton_method(
496
+ "_clamp_min",
497
+ *[](const Tensor &self, Scalar min) {
498
+ return torch::clamp_min(self, min);
499
+ })
500
+ .define_singleton_method(
501
+ "_clamp_min_",
502
+ *[](Tensor &self, Scalar min) {
503
+ return torch::clamp_min_(self, min);
504
+ })
505
+ .define_singleton_method(
506
+ "_clamp_min_out",
507
+ *[](const Tensor &self, Scalar min, Tensor &out) {
508
+ return torch::clamp_min_out(out, self, min);
509
+ })
510
+ .define_singleton_method(
511
+ "_clone",
512
+ *[](const Tensor &self) {
513
+ return torch::clone(self);
514
+ })
515
+ .define_singleton_method(
516
+ "_combinations",
517
+ *[](const Tensor &self, int64_t r, bool with_replacement) {
518
+ return torch::combinations(self, r, with_replacement);
519
+ })
520
+ .define_singleton_method(
521
+ "_constant_pad_nd",
522
+ *[](const Tensor &self, IntArrayRef pad, Scalar value) {
523
+ return torch::constant_pad_nd(self, pad, value);
524
+ })
525
+ .define_singleton_method(
526
+ "_conv1d",
527
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, int64_t groups) {
528
+ return torch::conv1d(input, weight, bias, stride, padding, dilation, groups);
529
+ })
530
+ .define_singleton_method(
531
+ "_conv2d",
532
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, int64_t groups) {
533
+ return torch::conv2d(input, weight, bias, stride, padding, dilation, groups);
534
+ })
535
+ .define_singleton_method(
536
+ "_conv3d",
537
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, int64_t groups) {
538
+ return torch::conv3d(input, weight, bias, stride, padding, dilation, groups);
539
+ })
540
+ .define_singleton_method(
541
+ "_conv_tbc",
542
+ *[](const Tensor &self, const Tensor &weight, const Tensor &bias, int64_t pad) {
543
+ return torch::conv_tbc(self, weight, bias, pad);
544
+ })
545
+ .define_singleton_method(
546
+ "_conv_transpose1d",
547
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef output_padding, int64_t groups, IntArrayRef dilation) {
548
+ return torch::conv_transpose1d(input, weight, bias, stride, padding, output_padding, groups, dilation);
549
+ })
550
+ .define_singleton_method(
551
+ "_conv_transpose2d_input",
552
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef output_padding, int64_t groups, IntArrayRef dilation) {
553
+ return torch::conv_transpose2d(input, weight, bias, stride, padding, output_padding, groups, dilation);
554
+ })
555
+ .define_singleton_method(
556
+ "_conv_transpose3d_input",
557
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef output_padding, int64_t groups, IntArrayRef dilation) {
558
+ return torch::conv_transpose3d(input, weight, bias, stride, padding, output_padding, groups, dilation);
559
+ })
560
+ .define_singleton_method(
561
+ "_convolution",
562
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool transposed, IntArrayRef output_padding, int64_t groups) {
563
+ return torch::convolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups);
564
+ })
565
+ .define_singleton_method(
566
+ "_convolution_overrideable",
567
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool transposed, IntArrayRef output_padding, int64_t groups) {
568
+ return torch::convolution_overrideable(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups);
569
+ })
570
+ .define_singleton_method(
571
+ "_copy_sparse_to_sparse_",
572
+ *[](Tensor &self, const Tensor &src, bool non_blocking) {
573
+ return torch::copy_sparse_to_sparse_(self, src, non_blocking);
574
+ })
575
+ .define_singleton_method(
576
+ "_cos",
577
+ *[](const Tensor &self) {
578
+ return torch::cos(self);
579
+ })
580
+ .define_singleton_method(
581
+ "_cos_",
582
+ *[](Tensor &self) {
583
+ return torch::cos_(self);
584
+ })
585
+ .define_singleton_method(
586
+ "_cos_out",
587
+ *[](const Tensor &self, Tensor &out) {
588
+ return torch::cos_out(out, self);
589
+ })
590
+ .define_singleton_method(
591
+ "_cosh",
592
+ *[](const Tensor &self) {
593
+ return torch::cosh(self);
594
+ })
595
+ .define_singleton_method(
596
+ "_cosh_",
597
+ *[](Tensor &self) {
598
+ return torch::cosh_(self);
599
+ })
600
+ .define_singleton_method(
601
+ "_cosh_out",
602
+ *[](const Tensor &self, Tensor &out) {
603
+ return torch::cosh_out(out, self);
604
+ })
605
+ .define_singleton_method(
606
+ "_cosine_embedding_loss",
607
+ *[](const Tensor &input1, const Tensor &input2, const Tensor &target, double margin, MyReduction reduction) {
608
+ return torch::cosine_embedding_loss(input1, input2, target, margin, reduction);
609
+ })
610
+ .define_singleton_method(
611
+ "_cosine_similarity",
612
+ *[](const Tensor &x1, const Tensor &x2, int64_t dim, double eps) {
613
+ return torch::cosine_similarity(x1, x2, dim, eps);
614
+ })
615
+ .define_singleton_method(
616
+ "_ctc_loss_intlist",
617
+ *[](const Tensor &log_probs, const Tensor &targets, IntArrayRef input_lengths, IntArrayRef target_lengths, int64_t blank, MyReduction reduction, bool zero_infinity) {
618
+ return torch::ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, reduction, zero_infinity);
619
+ })
620
+ .define_singleton_method(
621
+ "_ctc_loss_tensor",
622
+ *[](const Tensor &log_probs, const Tensor &targets, const Tensor &input_lengths, const Tensor &target_lengths, int64_t blank, MyReduction reduction, bool zero_infinity) {
623
+ return torch::ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, reduction, zero_infinity);
624
+ })
625
+ .define_singleton_method(
626
+ "_cudnn_affine_grid_generator",
627
+ *[](const Tensor &theta, int64_t N, int64_t C, int64_t H, int64_t W) {
628
+ return torch::cudnn_affine_grid_generator(theta, N, C, H, W);
629
+ })
630
+ .define_singleton_method(
631
+ "_cudnn_batch_norm",
632
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, OptionalTensor running_mean, OptionalTensor running_var, bool training, double exponential_average_factor, double epsilon) {
633
+ return torch::cudnn_batch_norm(input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon);
634
+ })
635
+ .define_singleton_method(
636
+ "_cudnn_convolution",
637
+ *[](const Tensor &self, const Tensor &weight, OptionalTensor bias, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
638
+ return torch::cudnn_convolution(self, weight, bias, padding, stride, dilation, groups, benchmark, deterministic);
639
+ })
640
+ .define_singleton_method(
641
+ "_cudnn_convolution_backward_bias",
642
+ *[](const Tensor &grad_output) {
643
+ return torch::cudnn_convolution_backward_bias(grad_output);
644
+ })
645
+ .define_singleton_method(
646
+ "_cudnn_convolution_backward_input",
647
+ *[](IntArrayRef self_size, const Tensor &grad_output, const Tensor &weight, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
648
+ return torch::cudnn_convolution_backward_input(self_size, grad_output, weight, padding, stride, dilation, groups, benchmark, deterministic);
649
+ })
650
+ .define_singleton_method(
651
+ "_cudnn_convolution_backward_weight",
652
+ *[](IntArrayRef weight_size, const Tensor &grad_output, const Tensor &self, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
653
+ return torch::cudnn_convolution_backward_weight(weight_size, grad_output, self, padding, stride, dilation, groups, benchmark, deterministic);
654
+ })
655
+ .define_singleton_method(
656
+ "_cudnn_convolution_transpose",
657
+ *[](const Tensor &self, const Tensor &weight, OptionalTensor bias, IntArrayRef padding, IntArrayRef output_padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
658
+ return torch::cudnn_convolution_transpose(self, weight, bias, padding, output_padding, stride, dilation, groups, benchmark, deterministic);
659
+ })
660
+ .define_singleton_method(
661
+ "_cudnn_convolution_transpose_backward_bias",
662
+ *[](const Tensor &grad_output) {
663
+ return torch::cudnn_convolution_transpose_backward_bias(grad_output);
664
+ })
665
+ .define_singleton_method(
666
+ "_cudnn_convolution_transpose_backward_input",
667
+ *[](const Tensor &grad_output, const Tensor &weight, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
668
+ return torch::cudnn_convolution_transpose_backward_input(grad_output, weight, padding, stride, dilation, groups, benchmark, deterministic);
669
+ })
670
+ .define_singleton_method(
671
+ "_cudnn_convolution_transpose_backward_weight",
672
+ *[](IntArrayRef weight_size, const Tensor &grad_output, const Tensor &self, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
673
+ return torch::cudnn_convolution_transpose_backward_weight(weight_size, grad_output, self, padding, stride, dilation, groups, benchmark, deterministic);
674
+ })
675
+ .define_singleton_method(
676
+ "_cudnn_grid_sampler",
677
+ *[](const Tensor &self, const Tensor &grid) {
678
+ return torch::cudnn_grid_sampler(self, grid);
679
+ })
680
+ .define_singleton_method(
681
+ "_cudnn_is_acceptable",
682
+ *[](const Tensor &self) {
683
+ return torch::cudnn_is_acceptable(self);
684
+ })
685
+ .define_singleton_method(
686
+ "_dequantize",
687
+ *[](const Tensor &self) {
688
+ return torch::dequantize(self);
689
+ })
690
+ .define_singleton_method(
691
+ "_det",
692
+ *[](const Tensor &self) {
693
+ return torch::det(self);
694
+ })
695
+ .define_singleton_method(
696
+ "_detach",
697
+ *[](const Tensor &self) {
698
+ return torch::detach(self);
699
+ })
700
+ .define_singleton_method(
701
+ "_detach_",
702
+ *[](Tensor &self) {
703
+ return torch::detach_(self);
704
+ })
705
+ .define_singleton_method(
706
+ "_diag",
707
+ *[](const Tensor &self, int64_t diagonal) {
708
+ return torch::diag(self, diagonal);
709
+ })
710
+ .define_singleton_method(
711
+ "_diag_embed",
712
+ *[](const Tensor &self, int64_t offset, int64_t dim1, int64_t dim2) {
713
+ return torch::diag_embed(self, offset, dim1, dim2);
714
+ })
715
+ .define_singleton_method(
716
+ "_diag_out",
717
+ *[](const Tensor &self, int64_t diagonal, Tensor &out) {
718
+ return torch::diag_out(out, self, diagonal);
719
+ })
720
+ .define_singleton_method(
721
+ "_diagflat",
722
+ *[](const Tensor &self, int64_t offset) {
723
+ return torch::diagflat(self, offset);
724
+ })
725
+ .define_singleton_method(
726
+ "_diagonal",
727
+ *[](Tensor &self, int64_t offset, int64_t dim1, int64_t dim2) {
728
+ return torch::diagonal(self, offset, dim1, dim2);
729
+ })
730
+ .define_singleton_method(
731
+ "_digamma",
732
+ *[](const Tensor &self) {
733
+ return torch::digamma(self);
734
+ })
735
+ .define_singleton_method(
736
+ "_digamma_out",
737
+ *[](const Tensor &self, Tensor &out) {
738
+ return torch::digamma_out(out, self);
739
+ })
740
+ .define_singleton_method(
741
+ "_dist",
742
+ *[](const Tensor &self, const Tensor &other, Scalar p) {
743
+ return torch::dist(self, other, p);
744
+ })
745
+ .define_singleton_method(
746
+ "_div_out",
747
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
748
+ return torch::div_out(out, self, other);
749
+ })
750
+ .define_singleton_method(
751
+ "_div_scalar",
752
+ *[](const Tensor &self, Scalar other) {
753
+ return torch::div(self, other);
754
+ })
755
+ .define_singleton_method(
756
+ "_div_tensor",
757
+ *[](const Tensor &self, const Tensor &other) {
758
+ return torch::div(self, other);
759
+ })
760
+ .define_singleton_method(
761
+ "_dot",
762
+ *[](const Tensor &self, const Tensor &tensor) {
763
+ return torch::dot(self, tensor);
764
+ })
765
+ .define_singleton_method(
766
+ "_dot_out",
767
+ *[](const Tensor &self, const Tensor &tensor, Tensor &out) {
768
+ return torch::dot_out(out, self, tensor);
769
+ })
770
+ .define_singleton_method(
771
+ "_dropout",
772
+ *[](const Tensor &input, double p, bool train) {
773
+ return torch::dropout(input, p, train);
774
+ })
775
+ .define_singleton_method(
776
+ "_dropout_",
777
+ *[](Tensor &self, double p, bool train) {
778
+ return torch::dropout_(self, p, train);
779
+ })
780
+ .define_singleton_method(
781
+ "_eig",
782
+ *[](const Tensor &self, bool eigenvectors) {
783
+ return torch::eig(self, eigenvectors);
784
+ })
785
+ .define_singleton_method(
786
+ "_eig_e",
787
+ *[](const Tensor &self, bool eigenvectors, Tensor &e, Tensor &v) {
788
+ return torch::eig_out(e, v, self, eigenvectors);
789
+ })
790
+ .define_singleton_method(
791
+ "_embedding",
792
+ *[](const Tensor &weight, const Tensor &indices, int64_t padding_idx, bool scale_grad_by_freq, bool sparse) {
793
+ return torch::embedding(weight, indices, padding_idx, scale_grad_by_freq, sparse);
794
+ })
795
+ .define_singleton_method(
796
+ "_embedding_bag",
797
+ *[](const Tensor &weight, const Tensor &indices, const Tensor &offsets, bool scale_grad_by_freq, int64_t mode, bool sparse, OptionalTensor per_sample_weights) {
798
+ return torch::embedding_bag(weight, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights);
799
+ })
800
+ .define_singleton_method(
801
+ "_embedding_renorm_",
802
+ *[](Tensor &self, const Tensor &indices, double max_norm, double norm_type) {
803
+ return torch::embedding_renorm_(self, indices, max_norm, norm_type);
804
+ })
805
+ .define_singleton_method(
806
+ "_empty_like",
807
+ *[](const Tensor &self) {
808
+ return torch::empty_like(self);
809
+ })
810
+ .define_singleton_method(
811
+ "_eq_scalar",
812
+ *[](const Tensor &self, Scalar other) {
813
+ return torch::eq(self, other);
814
+ })
815
+ .define_singleton_method(
816
+ "_eq_scalar_out",
817
+ *[](const Tensor &self, Scalar other, Tensor &out) {
818
+ return torch::eq_out(out, self, other);
819
+ })
820
+ .define_singleton_method(
821
+ "_eq_tensor",
822
+ *[](const Tensor &self, const Tensor &other) {
823
+ return torch::eq(self, other);
824
+ })
825
+ .define_singleton_method(
826
+ "_eq_tensor_out",
827
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
828
+ return torch::eq_out(out, self, other);
829
+ })
830
+ .define_singleton_method(
831
+ "_equal",
832
+ *[](const Tensor &self, const Tensor &other) {
833
+ return torch::equal(self, other);
834
+ })
835
+ .define_singleton_method(
836
+ "_erf",
837
+ *[](const Tensor &self) {
838
+ return torch::erf(self);
839
+ })
840
+ .define_singleton_method(
841
+ "_erf_",
842
+ *[](Tensor &self) {
843
+ return torch::erf_(self);
844
+ })
845
+ .define_singleton_method(
846
+ "_erf_out",
847
+ *[](const Tensor &self, Tensor &out) {
848
+ return torch::erf_out(out, self);
849
+ })
850
+ .define_singleton_method(
851
+ "_erfc",
852
+ *[](const Tensor &self) {
853
+ return torch::erfc(self);
854
+ })
855
+ .define_singleton_method(
856
+ "_erfc_",
857
+ *[](Tensor &self) {
858
+ return torch::erfc_(self);
859
+ })
860
+ .define_singleton_method(
861
+ "_erfc_out",
862
+ *[](const Tensor &self, Tensor &out) {
863
+ return torch::erfc_out(out, self);
864
+ })
865
+ .define_singleton_method(
866
+ "_erfinv",
867
+ *[](const Tensor &self) {
868
+ return torch::erfinv(self);
869
+ })
870
+ .define_singleton_method(
871
+ "_erfinv_out",
872
+ *[](const Tensor &self, Tensor &out) {
873
+ return torch::erfinv_out(out, self);
874
+ })
875
+ .define_singleton_method(
876
+ "_exp",
877
+ *[](const Tensor &self) {
878
+ return torch::exp(self);
879
+ })
880
+ .define_singleton_method(
881
+ "_exp_",
882
+ *[](Tensor &self) {
883
+ return torch::exp_(self);
884
+ })
885
+ .define_singleton_method(
886
+ "_exp_out",
887
+ *[](const Tensor &self, Tensor &out) {
888
+ return torch::exp_out(out, self);
889
+ })
890
+ .define_singleton_method(
891
+ "_expm1",
892
+ *[](const Tensor &self) {
893
+ return torch::expm1(self);
894
+ })
895
+ .define_singleton_method(
896
+ "_expm1_",
897
+ *[](Tensor &self) {
898
+ return torch::expm1_(self);
899
+ })
900
+ .define_singleton_method(
901
+ "_expm1_out",
902
+ *[](const Tensor &self, Tensor &out) {
903
+ return torch::expm1_out(out, self);
904
+ })
905
+ .define_singleton_method(
906
+ "_eye_m_out",
907
+ *[](int64_t n, int64_t m, Tensor &out) {
908
+ return torch::eye_out(out, n, m);
909
+ })
910
+ .define_singleton_method(
911
+ "_eye_out",
912
+ *[](int64_t n, Tensor &out) {
913
+ return torch::eye_out(out, n);
914
+ })
915
+ .define_singleton_method(
916
+ "_fake_quantize_per_channel_affine",
917
+ *[](const Tensor &self, const Tensor &scale, const Tensor &zero_point, int64_t axis, int64_t quant_min, int64_t quant_max) {
918
+ return torch::fake_quantize_per_channel_affine(self, scale, zero_point, axis, quant_min, quant_max);
919
+ })
920
+ .define_singleton_method(
921
+ "_fake_quantize_per_tensor_affine",
922
+ *[](const Tensor &self, double scale, int64_t zero_point, int64_t quant_min, int64_t quant_max) {
923
+ return torch::fake_quantize_per_tensor_affine(self, scale, zero_point, quant_min, quant_max);
924
+ })
925
+ .define_singleton_method(
926
+ "_fbgemm_linear_fp16_weight",
927
+ *[](const Tensor &input, const Tensor &packed_weight, const Tensor &bias) {
928
+ return torch::fbgemm_linear_fp16_weight(input, packed_weight, bias);
929
+ })
930
+ .define_singleton_method(
931
+ "_fbgemm_linear_fp16_weight_fp32_activation",
932
+ *[](const Tensor &input, const Tensor &packed_weight, const Tensor &bias) {
933
+ return torch::fbgemm_linear_fp16_weight_fp32_activation(input, packed_weight, bias);
934
+ })
935
+ .define_singleton_method(
936
+ "_fbgemm_linear_int8_weight",
937
+ *[](const Tensor &input, const Tensor &weight, const Tensor &packed, const Tensor &col_offsets, Scalar weight_scale, Scalar weight_zero_point, const Tensor &bias) {
938
+ return torch::fbgemm_linear_int8_weight(input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias);
939
+ })
940
+ .define_singleton_method(
941
+ "_fbgemm_linear_int8_weight_fp32_activation",
942
+ *[](const Tensor &input, const Tensor &weight, const Tensor &packed, const Tensor &col_offsets, Scalar weight_scale, Scalar weight_zero_point, const Tensor &bias) {
943
+ return torch::fbgemm_linear_int8_weight_fp32_activation(input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias);
944
+ })
945
+ .define_singleton_method(
946
+ "_fbgemm_linear_quantize_weight",
947
+ *[](const Tensor &input) {
948
+ return torch::fbgemm_linear_quantize_weight(input);
949
+ })
950
+ .define_singleton_method(
951
+ "_fbgemm_pack_gemm_matrix_fp16",
952
+ *[](const Tensor &input) {
953
+ return torch::fbgemm_pack_gemm_matrix_fp16(input);
954
+ })
955
+ .define_singleton_method(
956
+ "_fbgemm_pack_quantized_matrix",
957
+ *[](const Tensor &input) {
958
+ return torch::fbgemm_pack_quantized_matrix(input);
959
+ })
960
+ .define_singleton_method(
961
+ "_fbgemm_pack_quantized_matrix_kn",
962
+ *[](const Tensor &input, int64_t K, int64_t N) {
963
+ return torch::fbgemm_pack_quantized_matrix(input, K, N);
964
+ })
965
+ .define_singleton_method(
966
+ "_feature_alpha_dropout",
967
+ *[](const Tensor &input, double p, bool train) {
968
+ return torch::feature_alpha_dropout(input, p, train);
969
+ })
970
+ .define_singleton_method(
971
+ "_feature_alpha_dropout_",
972
+ *[](Tensor &self, double p, bool train) {
973
+ return torch::feature_alpha_dropout_(self, p, train);
974
+ })
975
+ .define_singleton_method(
976
+ "_feature_dropout",
977
+ *[](const Tensor &input, double p, bool train) {
978
+ return torch::feature_dropout(input, p, train);
979
+ })
980
+ .define_singleton_method(
981
+ "_feature_dropout_",
982
+ *[](Tensor &self, double p, bool train) {
983
+ return torch::feature_dropout_(self, p, train);
984
+ })
985
+ .define_singleton_method(
986
+ "_fft",
987
+ *[](const Tensor &self, int64_t signal_ndim, bool normalized) {
988
+ return torch::fft(self, signal_ndim, normalized);
989
+ })
990
+ .define_singleton_method(
991
+ "_fill__scalar",
992
+ *[](Tensor &self, Scalar value) {
993
+ return torch::fill_(self, value);
994
+ })
995
+ .define_singleton_method(
996
+ "_fill__tensor",
997
+ *[](Tensor &self, const Tensor &value) {
998
+ return torch::fill_(self, value);
999
+ })
1000
+ .define_singleton_method(
1001
+ "_flatten_using_ints",
1002
+ *[](const Tensor &self, int64_t start_dim, int64_t end_dim) {
1003
+ return torch::flatten(self, start_dim, end_dim);
1004
+ })
1005
+ .define_singleton_method(
1006
+ "_flip",
1007
+ *[](const Tensor &self, IntArrayRef dims) {
1008
+ return torch::flip(self, dims);
1009
+ })
1010
+ .define_singleton_method(
1011
+ "_floor",
1012
+ *[](const Tensor &self) {
1013
+ return torch::floor(self);
1014
+ })
1015
+ .define_singleton_method(
1016
+ "_floor_",
1017
+ *[](Tensor &self) {
1018
+ return torch::floor_(self);
1019
+ })
1020
+ .define_singleton_method(
1021
+ "_floor_out",
1022
+ *[](const Tensor &self, Tensor &out) {
1023
+ return torch::floor_out(out, self);
1024
+ })
1025
+ .define_singleton_method(
1026
+ "_fmod_scalar",
1027
+ *[](const Tensor &self, Scalar other) {
1028
+ return torch::fmod(self, other);
1029
+ })
1030
+ .define_singleton_method(
1031
+ "_fmod_scalar_out",
1032
+ *[](const Tensor &self, Scalar other, Tensor &out) {
1033
+ return torch::fmod_out(out, self, other);
1034
+ })
1035
+ .define_singleton_method(
1036
+ "_fmod_tensor",
1037
+ *[](const Tensor &self, const Tensor &other) {
1038
+ return torch::fmod(self, other);
1039
+ })
1040
+ .define_singleton_method(
1041
+ "_fmod_tensor_out",
1042
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1043
+ return torch::fmod_out(out, self, other);
1044
+ })
1045
+ .define_singleton_method(
1046
+ "_frac",
1047
+ *[](const Tensor &self) {
1048
+ return torch::frac(self);
1049
+ })
1050
+ .define_singleton_method(
1051
+ "_frac_",
1052
+ *[](Tensor &self) {
1053
+ return torch::frac_(self);
1054
+ })
1055
+ .define_singleton_method(
1056
+ "_frac_out",
1057
+ *[](const Tensor &self, Tensor &out) {
1058
+ return torch::frac_out(out, self);
1059
+ })
1060
+ .define_singleton_method(
1061
+ "_frobenius_norm",
1062
+ *[](const Tensor &self) {
1063
+ return torch::frobenius_norm(self);
1064
+ })
1065
+ .define_singleton_method(
1066
+ "_frobenius_norm_dim",
1067
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim) {
1068
+ return torch::frobenius_norm(self, dim, keepdim);
1069
+ })
1070
+ .define_singleton_method(
1071
+ "_frobenius_norm_out",
1072
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim, Tensor &out) {
1073
+ return torch::frobenius_norm_out(out, self, dim, keepdim);
1074
+ })
1075
+ .define_singleton_method(
1076
+ "_full_like",
1077
+ *[](const Tensor &self, Scalar fill_value) {
1078
+ return torch::full_like(self, fill_value);
1079
+ })
1080
+ .define_singleton_method(
1081
+ "_full_out",
1082
+ *[](IntArrayRef size, Scalar fill_value, Tensor &out) {
1083
+ return torch::full_out(out, size, fill_value);
1084
+ })
1085
+ .define_singleton_method(
1086
+ "_gather",
1087
+ *[](const Tensor &self, int64_t dim, const Tensor &index, bool sparse_grad) {
1088
+ return torch::gather(self, dim, index, sparse_grad);
1089
+ })
1090
+ .define_singleton_method(
1091
+ "_gather_out",
1092
+ *[](const Tensor &self, int64_t dim, const Tensor &index, bool sparse_grad, Tensor &out) {
1093
+ return torch::gather_out(out, self, dim, index, sparse_grad);
1094
+ })
1095
+ .define_singleton_method(
1096
+ "_ge_scalar",
1097
+ *[](const Tensor &self, Scalar other) {
1098
+ return torch::ge(self, other);
1099
+ })
1100
+ .define_singleton_method(
1101
+ "_ge_scalar_out",
1102
+ *[](const Tensor &self, Scalar other, Tensor &out) {
1103
+ return torch::ge_out(out, self, other);
1104
+ })
1105
+ .define_singleton_method(
1106
+ "_ge_tensor",
1107
+ *[](const Tensor &self, const Tensor &other) {
1108
+ return torch::ge(self, other);
1109
+ })
1110
+ .define_singleton_method(
1111
+ "_ge_tensor_out",
1112
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1113
+ return torch::ge_out(out, self, other);
1114
+ })
1115
+ .define_singleton_method(
1116
+ "_geqrf",
1117
+ *[](const Tensor &self) {
1118
+ return torch::geqrf(self);
1119
+ })
1120
+ .define_singleton_method(
1121
+ "_geqrf_a",
1122
+ *[](const Tensor &self, Tensor &a, Tensor &tau) {
1123
+ return torch::geqrf_out(a, tau, self);
1124
+ })
1125
+ .define_singleton_method(
1126
+ "_ger",
1127
+ *[](const Tensor &self, const Tensor &vec2) {
1128
+ return torch::ger(self, vec2);
1129
+ })
1130
+ .define_singleton_method(
1131
+ "_ger_out",
1132
+ *[](const Tensor &self, const Tensor &vec2, Tensor &out) {
1133
+ return torch::ger_out(out, self, vec2);
1134
+ })
1135
+ .define_singleton_method(
1136
+ "_grid_sampler",
1137
+ *[](const Tensor &input, const Tensor &grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners) {
1138
+ return torch::grid_sampler(input, grid, interpolation_mode, padding_mode, align_corners);
1139
+ })
1140
+ .define_singleton_method(
1141
+ "_grid_sampler_2d",
1142
+ *[](const Tensor &input, const Tensor &grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners) {
1143
+ return torch::grid_sampler_2d(input, grid, interpolation_mode, padding_mode, align_corners);
1144
+ })
1145
+ .define_singleton_method(
1146
+ "_grid_sampler_3d",
1147
+ *[](const Tensor &input, const Tensor &grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners) {
1148
+ return torch::grid_sampler_3d(input, grid, interpolation_mode, padding_mode, align_corners);
1149
+ })
1150
+ .define_singleton_method(
1151
+ "_group_norm",
1152
+ *[](const Tensor &input, int64_t num_groups, OptionalTensor weight, OptionalTensor bias, double eps, bool cudnn_enabled) {
1153
+ return torch::group_norm(input, num_groups, weight, bias, eps, cudnn_enabled);
1154
+ })
1155
+ .define_singleton_method(
1156
+ "_gru_cell",
1157
+ *[](const Tensor &input, const Tensor &hx, const Tensor &w_ih, const Tensor &w_hh, OptionalTensor b_ih, OptionalTensor b_hh) {
1158
+ return torch::gru_cell(input, hx, w_ih, w_hh, b_ih, b_hh);
1159
+ })
1160
+ .define_singleton_method(
1161
+ "_gru_data",
1162
+ *[](const Tensor &data, const Tensor &batch_sizes, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional) {
1163
+ return torch::gru(data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional);
1164
+ })
1165
+ .define_singleton_method(
1166
+ "_gru_input",
1167
+ *[](const Tensor &input, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional, bool batch_first) {
1168
+ return torch::gru(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first);
1169
+ })
1170
+ .define_singleton_method(
1171
+ "_gt_scalar",
1172
+ *[](const Tensor &self, Scalar other) {
1173
+ return torch::gt(self, other);
1174
+ })
1175
+ .define_singleton_method(
1176
+ "_gt_scalar_out",
1177
+ *[](const Tensor &self, Scalar other, Tensor &out) {
1178
+ return torch::gt_out(out, self, other);
1179
+ })
1180
+ .define_singleton_method(
1181
+ "_gt_tensor",
1182
+ *[](const Tensor &self, const Tensor &other) {
1183
+ return torch::gt(self, other);
1184
+ })
1185
+ .define_singleton_method(
1186
+ "_gt_tensor_out",
1187
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1188
+ return torch::gt_out(out, self, other);
1189
+ })
1190
+ .define_singleton_method(
1191
+ "_hardshrink",
1192
+ *[](const Tensor &self, Scalar lambd) {
1193
+ return torch::hardshrink(self, lambd);
1194
+ })
1195
+ .define_singleton_method(
1196
+ "_hinge_embedding_loss",
1197
+ *[](const Tensor &self, const Tensor &target, double margin, MyReduction reduction) {
1198
+ return torch::hinge_embedding_loss(self, target, margin, reduction);
1199
+ })
1200
+ .define_singleton_method(
1201
+ "_histc",
1202
+ *[](const Tensor &self, int64_t bins, Scalar min, Scalar max) {
1203
+ return torch::histc(self, bins, min, max);
1204
+ })
1205
+ .define_singleton_method(
1206
+ "_histc_out",
1207
+ *[](const Tensor &self, int64_t bins, Scalar min, Scalar max, Tensor &out) {
1208
+ return torch::histc_out(out, self, bins, min, max);
1209
+ })
1210
+ .define_singleton_method(
1211
+ "_hspmm",
1212
+ *[](const Tensor &mat1, const Tensor &mat2) {
1213
+ return torch::hspmm(mat1, mat2);
1214
+ })
1215
+ .define_singleton_method(
1216
+ "_hspmm_out",
1217
+ *[](const Tensor &mat1, const Tensor &mat2, Tensor &out) {
1218
+ return torch::hspmm_out(out, mat1, mat2);
1219
+ })
1220
+ .define_singleton_method(
1221
+ "_ifft",
1222
+ *[](const Tensor &self, int64_t signal_ndim, bool normalized) {
1223
+ return torch::ifft(self, signal_ndim, normalized);
1224
+ })
1225
+ .define_singleton_method(
1226
+ "_index_add",
1227
+ *[](const Tensor &self, int64_t dim, const Tensor &index, const Tensor &source) {
1228
+ return torch::index_add(self, dim, index, source);
1229
+ })
1230
+ .define_singleton_method(
1231
+ "_index_copy",
1232
+ *[](const Tensor &self, int64_t dim, const Tensor &index, const Tensor &source) {
1233
+ return torch::index_copy(self, dim, index, source);
1234
+ })
1235
+ .define_singleton_method(
1236
+ "_index_fill_scalar",
1237
+ *[](const Tensor &self, int64_t dim, const Tensor &index, Scalar value) {
1238
+ return torch::index_fill(self, dim, index, value);
1239
+ })
1240
+ .define_singleton_method(
1241
+ "_index_fill_tensor",
1242
+ *[](const Tensor &self, int64_t dim, const Tensor &index, const Tensor &value) {
1243
+ return torch::index_fill(self, dim, index, value);
1244
+ })
1245
+ .define_singleton_method(
1246
+ "_index_select",
1247
+ *[](const Tensor &self, int64_t dim, const Tensor &index) {
1248
+ return torch::index_select(self, dim, index);
1249
+ })
1250
+ .define_singleton_method(
1251
+ "_index_select_out",
1252
+ *[](const Tensor &self, int64_t dim, const Tensor &index, Tensor &out) {
1253
+ return torch::index_select_out(out, self, dim, index);
1254
+ })
1255
+ .define_singleton_method(
1256
+ "_instance_norm",
1257
+ *[](const Tensor &input, OptionalTensor weight, OptionalTensor bias, OptionalTensor running_mean, OptionalTensor running_var, bool use_input_stats, double momentum, double eps, bool cudnn_enabled) {
1258
+ return torch::instance_norm(input, weight, bias, running_mean, running_var, use_input_stats, momentum, eps, cudnn_enabled);
1259
+ })
1260
+ .define_singleton_method(
1261
+ "_int_repr",
1262
+ *[](const Tensor &self) {
1263
+ return torch::int_repr(self);
1264
+ })
1265
+ .define_singleton_method(
1266
+ "_inverse",
1267
+ *[](const Tensor &self) {
1268
+ return torch::inverse(self);
1269
+ })
1270
+ .define_singleton_method(
1271
+ "_inverse_out",
1272
+ *[](const Tensor &self, Tensor &out) {
1273
+ return torch::inverse_out(out, self);
1274
+ })
1275
+ .define_singleton_method(
1276
+ "_irfft",
1277
+ *[](const Tensor &self, int64_t signal_ndim, bool normalized, bool onesided, IntArrayRef signal_sizes) {
1278
+ return torch::irfft(self, signal_ndim, normalized, onesided, signal_sizes);
1279
+ })
1280
+ .define_singleton_method(
1281
+ "_is_complex",
1282
+ *[](const Tensor &self) {
1283
+ return torch::is_complex(self);
1284
+ })
1285
+ .define_singleton_method(
1286
+ "_is_distributed",
1287
+ *[](const Tensor &self) {
1288
+ return torch::is_distributed(self);
1289
+ })
1290
+ .define_singleton_method(
1291
+ "_is_floating_point",
1292
+ *[](const Tensor &self) {
1293
+ return torch::is_floating_point(self);
1294
+ })
1295
+ .define_singleton_method(
1296
+ "_is_nonzero",
1297
+ *[](const Tensor &self) {
1298
+ return torch::is_nonzero(self);
1299
+ })
1300
+ .define_singleton_method(
1301
+ "_is_same_size",
1302
+ *[](const Tensor &self, const Tensor &other) {
1303
+ return torch::is_same_size(self, other);
1304
+ })
1305
+ .define_singleton_method(
1306
+ "_is_signed",
1307
+ *[](const Tensor &self) {
1308
+ return torch::is_signed(self);
1309
+ })
1310
+ .define_singleton_method(
1311
+ "_isclose",
1312
+ *[](const Tensor &self, const Tensor &other, double rtol, double atol, bool equal_nan) {
1313
+ return torch::isclose(self, other, rtol, atol, equal_nan);
1314
+ })
1315
+ .define_singleton_method(
1316
+ "_isnan",
1317
+ *[](const Tensor &self) {
1318
+ return torch::isnan(self);
1319
+ })
1320
+ .define_singleton_method(
1321
+ "_kl_div",
1322
+ *[](const Tensor &self, const Tensor &target, MyReduction reduction) {
1323
+ return torch::kl_div(self, target, reduction);
1324
+ })
1325
+ .define_singleton_method(
1326
+ "_kthvalue",
1327
+ *[](const Tensor &self, int64_t k, int64_t dim, bool keepdim) {
1328
+ return torch::kthvalue(self, k, dim, keepdim);
1329
+ })
1330
+ .define_singleton_method(
1331
+ "_kthvalue_values",
1332
+ *[](const Tensor &self, int64_t k, int64_t dim, bool keepdim, Tensor &values, Tensor &indices) {
1333
+ return torch::kthvalue_out(values, indices, self, k, dim, keepdim);
1334
+ })
1335
+ .define_singleton_method(
1336
+ "_layer_norm",
1337
+ *[](const Tensor &input, IntArrayRef normalized_shape, OptionalTensor weight, OptionalTensor bias, double eps, bool cudnn_enable) {
1338
+ return torch::layer_norm(input, normalized_shape, weight, bias, eps, cudnn_enable);
1339
+ })
1340
+ .define_singleton_method(
1341
+ "_le_scalar",
1342
+ *[](const Tensor &self, Scalar other) {
1343
+ return torch::le(self, other);
1344
+ })
1345
+ .define_singleton_method(
1346
+ "_le_scalar_out",
1347
+ *[](const Tensor &self, Scalar other, Tensor &out) {
1348
+ return torch::le_out(out, self, other);
1349
+ })
1350
+ .define_singleton_method(
1351
+ "_le_tensor",
1352
+ *[](const Tensor &self, const Tensor &other) {
1353
+ return torch::le(self, other);
1354
+ })
1355
+ .define_singleton_method(
1356
+ "_le_tensor_out",
1357
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1358
+ return torch::le_out(out, self, other);
1359
+ })
1360
+ .define_singleton_method(
1361
+ "_lerp_scalar",
1362
+ *[](const Tensor &self, const Tensor &end, Scalar weight) {
1363
+ return torch::lerp(self, end, weight);
1364
+ })
1365
+ .define_singleton_method(
1366
+ "_lerp_scalar_out",
1367
+ *[](const Tensor &self, const Tensor &end, Scalar weight, Tensor &out) {
1368
+ return torch::lerp_out(out, self, end, weight);
1369
+ })
1370
+ .define_singleton_method(
1371
+ "_lerp_tensor",
1372
+ *[](const Tensor &self, const Tensor &end, const Tensor &weight) {
1373
+ return torch::lerp(self, end, weight);
1374
+ })
1375
+ .define_singleton_method(
1376
+ "_lerp_tensor_out",
1377
+ *[](const Tensor &self, const Tensor &end, const Tensor &weight, Tensor &out) {
1378
+ return torch::lerp_out(out, self, end, weight);
1379
+ })
1380
+ .define_singleton_method(
1381
+ "_lgamma",
1382
+ *[](const Tensor &self) {
1383
+ return torch::lgamma(self);
1384
+ })
1385
+ .define_singleton_method(
1386
+ "_lgamma_out",
1387
+ *[](const Tensor &self, Tensor &out) {
1388
+ return torch::lgamma_out(out, self);
1389
+ })
1390
+ .define_singleton_method(
1391
+ "_linspace_out",
1392
+ *[](Scalar start, Scalar end, int64_t steps, Tensor &out) {
1393
+ return torch::linspace_out(out, start, end, steps);
1394
+ })
1395
+ .define_singleton_method(
1396
+ "_log",
1397
+ *[](const Tensor &self) {
1398
+ return torch::log(self);
1399
+ })
1400
+ .define_singleton_method(
1401
+ "_log10",
1402
+ *[](const Tensor &self) {
1403
+ return torch::log10(self);
1404
+ })
1405
+ .define_singleton_method(
1406
+ "_log10_",
1407
+ *[](Tensor &self) {
1408
+ return torch::log10_(self);
1409
+ })
1410
+ .define_singleton_method(
1411
+ "_log10_out",
1412
+ *[](const Tensor &self, Tensor &out) {
1413
+ return torch::log10_out(out, self);
1414
+ })
1415
+ .define_singleton_method(
1416
+ "_log1p",
1417
+ *[](const Tensor &self) {
1418
+ return torch::log1p(self);
1419
+ })
1420
+ .define_singleton_method(
1421
+ "_log1p_",
1422
+ *[](Tensor &self) {
1423
+ return torch::log1p_(self);
1424
+ })
1425
+ .define_singleton_method(
1426
+ "_log1p_out",
1427
+ *[](const Tensor &self, Tensor &out) {
1428
+ return torch::log1p_out(out, self);
1429
+ })
1430
+ .define_singleton_method(
1431
+ "_log2",
1432
+ *[](const Tensor &self) {
1433
+ return torch::log2(self);
1434
+ })
1435
+ .define_singleton_method(
1436
+ "_log2_",
1437
+ *[](Tensor &self) {
1438
+ return torch::log2_(self);
1439
+ })
1440
+ .define_singleton_method(
1441
+ "_log2_out",
1442
+ *[](const Tensor &self, Tensor &out) {
1443
+ return torch::log2_out(out, self);
1444
+ })
1445
+ .define_singleton_method(
1446
+ "_log_",
1447
+ *[](Tensor &self) {
1448
+ return torch::log_(self);
1449
+ })
1450
+ .define_singleton_method(
1451
+ "_log_out",
1452
+ *[](const Tensor &self, Tensor &out) {
1453
+ return torch::log_out(out, self);
1454
+ })
1455
+ .define_singleton_method(
1456
+ "_logdet",
1457
+ *[](const Tensor &self) {
1458
+ return torch::logdet(self);
1459
+ })
1460
+ .define_singleton_method(
1461
+ "_logical_not",
1462
+ *[](const Tensor &self) {
1463
+ return torch::logical_not(self);
1464
+ })
1465
+ .define_singleton_method(
1466
+ "_logical_not_out",
1467
+ *[](const Tensor &self, Tensor &out) {
1468
+ return torch::logical_not_out(out, self);
1469
+ })
1470
+ .define_singleton_method(
1471
+ "_logical_xor",
1472
+ *[](const Tensor &self, const Tensor &other) {
1473
+ return torch::logical_xor(self, other);
1474
+ })
1475
+ .define_singleton_method(
1476
+ "_logical_xor_out",
1477
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1478
+ return torch::logical_xor_out(out, self, other);
1479
+ })
1480
+ .define_singleton_method(
1481
+ "_logspace_out",
1482
+ *[](Scalar start, Scalar end, int64_t steps, double base, Tensor &out) {
1483
+ return torch::logspace_out(out, start, end, steps, base);
1484
+ })
1485
+ .define_singleton_method(
1486
+ "_logsumexp",
1487
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim) {
1488
+ return torch::logsumexp(self, dim, keepdim);
1489
+ })
1490
+ .define_singleton_method(
1491
+ "_logsumexp_out",
1492
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim, Tensor &out) {
1493
+ return torch::logsumexp_out(out, self, dim, keepdim);
1494
+ })
1495
+ .define_singleton_method(
1496
+ "_lstm_cell",
1497
+ *[](const Tensor &input, TensorList hx, const Tensor &w_ih, const Tensor &w_hh, OptionalTensor b_ih, OptionalTensor b_hh) {
1498
+ return torch::lstm_cell(input, hx, w_ih, w_hh, b_ih, b_hh);
1499
+ })
1500
+ .define_singleton_method(
1501
+ "_lstm_data",
1502
+ *[](const Tensor &data, const Tensor &batch_sizes, TensorList hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional) {
1503
+ return torch::lstm(data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional);
1504
+ })
1505
+ .define_singleton_method(
1506
+ "_lstm_input",
1507
+ *[](const Tensor &input, TensorList hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional, bool batch_first) {
1508
+ return torch::lstm(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first);
1509
+ })
1510
+ .define_singleton_method(
1511
+ "_lstsq",
1512
+ *[](const Tensor &self, const Tensor &A) {
1513
+ return torch::lstsq(self, A);
1514
+ })
1515
+ .define_singleton_method(
1516
+ "_lstsq_x",
1517
+ *[](const Tensor &self, const Tensor &A, Tensor &X, Tensor &qr) {
1518
+ return torch::lstsq_out(X, qr, self, A);
1519
+ })
1520
+ .define_singleton_method(
1521
+ "_lt_scalar",
1522
+ *[](const Tensor &self, Scalar other) {
1523
+ return torch::lt(self, other);
1524
+ })
1525
+ .define_singleton_method(
1526
+ "_lt_scalar_out",
1527
+ *[](const Tensor &self, Scalar other, Tensor &out) {
1528
+ return torch::lt_out(out, self, other);
1529
+ })
1530
+ .define_singleton_method(
1531
+ "_lt_tensor",
1532
+ *[](const Tensor &self, const Tensor &other) {
1533
+ return torch::lt(self, other);
1534
+ })
1535
+ .define_singleton_method(
1536
+ "_lt_tensor_out",
1537
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1538
+ return torch::lt_out(out, self, other);
1539
+ })
1540
+ .define_singleton_method(
1541
+ "_lu_solve",
1542
+ *[](const Tensor &self, const Tensor &LU_data, const Tensor &LU_pivots) {
1543
+ return torch::lu_solve(self, LU_data, LU_pivots);
1544
+ })
1545
+ .define_singleton_method(
1546
+ "_lu_solve_out",
1547
+ *[](const Tensor &self, const Tensor &LU_data, const Tensor &LU_pivots, Tensor &out) {
1548
+ return torch::lu_solve_out(out, self, LU_data, LU_pivots);
1549
+ })
1550
+ .define_singleton_method(
1551
+ "_margin_ranking_loss",
1552
+ *[](const Tensor &input1, const Tensor &input2, const Tensor &target, double margin, MyReduction reduction) {
1553
+ return torch::margin_ranking_loss(input1, input2, target, margin, reduction);
1554
+ })
1555
+ .define_singleton_method(
1556
+ "_masked_fill_scalar",
1557
+ *[](const Tensor &self, const Tensor &mask, Scalar value) {
1558
+ return torch::masked_fill(self, mask, value);
1559
+ })
1560
+ .define_singleton_method(
1561
+ "_masked_fill_tensor",
1562
+ *[](const Tensor &self, const Tensor &mask, const Tensor &value) {
1563
+ return torch::masked_fill(self, mask, value);
1564
+ })
1565
+ .define_singleton_method(
1566
+ "_masked_scatter",
1567
+ *[](const Tensor &self, const Tensor &mask, const Tensor &source) {
1568
+ return torch::masked_scatter(self, mask, source);
1569
+ })
1570
+ .define_singleton_method(
1571
+ "_masked_select",
1572
+ *[](const Tensor &self, const Tensor &mask) {
1573
+ return torch::masked_select(self, mask);
1574
+ })
1575
+ .define_singleton_method(
1576
+ "_masked_select_out",
1577
+ *[](const Tensor &self, const Tensor &mask, Tensor &out) {
1578
+ return torch::masked_select_out(out, self, mask);
1579
+ })
1580
+ .define_singleton_method(
1581
+ "_matmul",
1582
+ *[](const Tensor &self, const Tensor &other) {
1583
+ return torch::matmul(self, other);
1584
+ })
1585
+ .define_singleton_method(
1586
+ "_matmul_out",
1587
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1588
+ return torch::matmul_out(out, self, other);
1589
+ })
1590
+ .define_singleton_method(
1591
+ "_matrix_power",
1592
+ *[](const Tensor &self, int64_t n) {
1593
+ return torch::matrix_power(self, n);
1594
+ })
1595
+ .define_singleton_method(
1596
+ "_matrix_rank",
1597
+ *[](const Tensor &self, bool symmetric) {
1598
+ return torch::matrix_rank(self, symmetric);
1599
+ })
1600
+ .define_singleton_method(
1601
+ "_matrix_rank_tol",
1602
+ *[](const Tensor &self, double tol, bool symmetric) {
1603
+ return torch::matrix_rank(self, tol, symmetric);
1604
+ })
1605
+ .define_singleton_method(
1606
+ "_max",
1607
+ *[](const Tensor &self) {
1608
+ return torch::max(self);
1609
+ })
1610
+ .define_singleton_method(
1611
+ "_max_dim",
1612
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
1613
+ return torch::max(self, dim, keepdim);
1614
+ })
1615
+ .define_singleton_method(
1616
+ "_max_dim_max",
1617
+ *[](const Tensor &self, int64_t dim, bool keepdim, Tensor &max, Tensor &max_values) {
1618
+ return torch::max_out(max, max_values, self, dim, keepdim);
1619
+ })
1620
+ .define_singleton_method(
1621
+ "_max_other",
1622
+ *[](const Tensor &self, const Tensor &other) {
1623
+ return torch::max(self, other);
1624
+ })
1625
+ .define_singleton_method(
1626
+ "_max_out",
1627
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1628
+ return torch::max_out(out, self, other);
1629
+ })
1630
+ .define_singleton_method(
1631
+ "_max_pool1d",
1632
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) {
1633
+ return torch::max_pool1d(self, kernel_size, stride, padding, dilation, ceil_mode);
1634
+ })
1635
+ .define_singleton_method(
1636
+ "_max_pool1d_with_indices",
1637
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) {
1638
+ return torch::max_pool1d_with_indices(self, kernel_size, stride, padding, dilation, ceil_mode);
1639
+ })
1640
+ .define_singleton_method(
1641
+ "_max_pool2d",
1642
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) {
1643
+ return torch::max_pool2d(self, kernel_size, stride, padding, dilation, ceil_mode);
1644
+ })
1645
+ .define_singleton_method(
1646
+ "_max_pool3d",
1647
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) {
1648
+ return torch::max_pool3d(self, kernel_size, stride, padding, dilation, ceil_mode);
1649
+ })
1650
+ .define_singleton_method(
1651
+ "_max_values",
1652
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim) {
1653
+ return torch::max_values(self, dim, keepdim);
1654
+ })
1655
+ .define_singleton_method(
1656
+ "_median",
1657
+ *[](const Tensor &self) {
1658
+ return torch::median(self);
1659
+ })
1660
+ .define_singleton_method(
1661
+ "_median_dim",
1662
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
1663
+ return torch::median(self, dim, keepdim);
1664
+ })
1665
+ .define_singleton_method(
1666
+ "_median_dim_values",
1667
+ *[](const Tensor &self, int64_t dim, bool keepdim, Tensor &values, Tensor &indices) {
1668
+ return torch::median_out(values, indices, self, dim, keepdim);
1669
+ })
1670
+ .define_singleton_method(
1671
+ "_meshgrid",
1672
+ *[](TensorList tensors) {
1673
+ return torch::meshgrid(tensors);
1674
+ })
1675
+ .define_singleton_method(
1676
+ "_min",
1677
+ *[](const Tensor &self) {
1678
+ return torch::min(self);
1679
+ })
1680
+ .define_singleton_method(
1681
+ "_min_dim",
1682
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
1683
+ return torch::min(self, dim, keepdim);
1684
+ })
1685
+ .define_singleton_method(
1686
+ "_min_dim_min",
1687
+ *[](const Tensor &self, int64_t dim, bool keepdim, Tensor &min, Tensor &min_indices) {
1688
+ return torch::min_out(min, min_indices, self, dim, keepdim);
1689
+ })
1690
+ .define_singleton_method(
1691
+ "_min_other",
1692
+ *[](const Tensor &self, const Tensor &other) {
1693
+ return torch::min(self, other);
1694
+ })
1695
+ .define_singleton_method(
1696
+ "_min_out",
1697
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1698
+ return torch::min_out(out, self, other);
1699
+ })
1700
+ .define_singleton_method(
1701
+ "_min_values",
1702
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim) {
1703
+ return torch::min_values(self, dim, keepdim);
1704
+ })
1705
+ .define_singleton_method(
1706
+ "_miopen_batch_norm",
1707
+ *[](const Tensor &input, const Tensor &weight, OptionalTensor bias, OptionalTensor running_mean, OptionalTensor running_var, bool training, double exponential_average_factor, double epsilon) {
1708
+ return torch::miopen_batch_norm(input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon);
1709
+ })
1710
+ .define_singleton_method(
1711
+ "_miopen_convolution",
1712
+ *[](const Tensor &self, const Tensor &weight, OptionalTensor bias, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1713
+ return torch::miopen_convolution(self, weight, bias, padding, stride, dilation, groups, benchmark, deterministic);
1714
+ })
1715
+ .define_singleton_method(
1716
+ "_miopen_convolution_backward_bias",
1717
+ *[](const Tensor &grad_output) {
1718
+ return torch::miopen_convolution_backward_bias(grad_output);
1719
+ })
1720
+ .define_singleton_method(
1721
+ "_miopen_convolution_backward_input",
1722
+ *[](IntArrayRef self_size, const Tensor &grad_output, const Tensor &weight, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1723
+ return torch::miopen_convolution_backward_input(self_size, grad_output, weight, padding, stride, dilation, groups, benchmark, deterministic);
1724
+ })
1725
+ .define_singleton_method(
1726
+ "_miopen_convolution_backward_weight",
1727
+ *[](IntArrayRef weight_size, const Tensor &grad_output, const Tensor &self, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1728
+ return torch::miopen_convolution_backward_weight(weight_size, grad_output, self, padding, stride, dilation, groups, benchmark, deterministic);
1729
+ })
1730
+ .define_singleton_method(
1731
+ "_miopen_convolution_transpose",
1732
+ *[](const Tensor &self, const Tensor &weight, OptionalTensor bias, IntArrayRef padding, IntArrayRef output_padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1733
+ return torch::miopen_convolution_transpose(self, weight, bias, padding, output_padding, stride, dilation, groups, benchmark, deterministic);
1734
+ })
1735
+ .define_singleton_method(
1736
+ "_miopen_convolution_transpose_backward_input",
1737
+ *[](const Tensor &grad_output, const Tensor &weight, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1738
+ return torch::miopen_convolution_transpose_backward_input(grad_output, weight, padding, stride, dilation, groups, benchmark, deterministic);
1739
+ })
1740
+ .define_singleton_method(
1741
+ "_miopen_convolution_transpose_backward_weight",
1742
+ *[](IntArrayRef weight_size, const Tensor &grad_output, const Tensor &self, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1743
+ return torch::miopen_convolution_transpose_backward_weight(weight_size, grad_output, self, padding, stride, dilation, groups, benchmark, deterministic);
1744
+ })
1745
+ .define_singleton_method(
1746
+ "_miopen_depthwise_convolution",
1747
+ *[](const Tensor &self, const Tensor &weight, OptionalTensor bias, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1748
+ return torch::miopen_depthwise_convolution(self, weight, bias, padding, stride, dilation, groups, benchmark, deterministic);
1749
+ })
1750
+ .define_singleton_method(
1751
+ "_miopen_depthwise_convolution_backward_input",
1752
+ *[](IntArrayRef self_size, const Tensor &grad_output, const Tensor &weight, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1753
+ return torch::miopen_depthwise_convolution_backward_input(self_size, grad_output, weight, padding, stride, dilation, groups, benchmark, deterministic);
1754
+ })
1755
+ .define_singleton_method(
1756
+ "_miopen_depthwise_convolution_backward_weight",
1757
+ *[](IntArrayRef weight_size, const Tensor &grad_output, const Tensor &self, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool benchmark, bool deterministic) {
1758
+ return torch::miopen_depthwise_convolution_backward_weight(weight_size, grad_output, self, padding, stride, dilation, groups, benchmark, deterministic);
1759
+ })
1760
+ .define_singleton_method(
1761
+ "_miopen_rnn",
1762
+ *[](const Tensor &input, TensorList weight, int64_t weight_stride0, const Tensor &hx, OptionalTensor cx, int64_t mode, int64_t hidden_size, int64_t num_layers, bool batch_first, double dropout, bool train, bool bidirectional, IntArrayRef batch_sizes, OptionalTensor dropout_state) {
1763
+ return torch::miopen_rnn(input, weight, weight_stride0, hx, cx, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state);
1764
+ })
1765
+ .define_singleton_method(
1766
+ "_mkldnn_adaptive_avg_pool2d",
1767
+ *[](const Tensor &self, IntArrayRef output_size) {
1768
+ return torch::mkldnn_adaptive_avg_pool2d(self, output_size);
1769
+ })
1770
+ .define_singleton_method(
1771
+ "_mkldnn_convolution",
1772
+ *[](const Tensor &self, const Tensor &weight, OptionalTensor bias, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups) {
1773
+ return torch::mkldnn_convolution(self, weight, bias, padding, stride, dilation, groups);
1774
+ })
1775
+ .define_singleton_method(
1776
+ "_mkldnn_convolution_backward_input",
1777
+ *[](IntArrayRef self_size, const Tensor &grad_output, const Tensor &weight, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool bias_defined) {
1778
+ return torch::mkldnn_convolution_backward_input(self_size, grad_output, weight, padding, stride, dilation, groups, bias_defined);
1779
+ })
1780
+ .define_singleton_method(
1781
+ "_mkldnn_convolution_backward_weights",
1782
+ *[](IntArrayRef weight_size, const Tensor &grad_output, const Tensor &self, IntArrayRef padding, IntArrayRef stride, IntArrayRef dilation, int64_t groups, bool bias_defined) {
1783
+ return torch::mkldnn_convolution_backward_weights(weight_size, grad_output, self, padding, stride, dilation, groups, bias_defined);
1784
+ })
1785
+ .define_singleton_method(
1786
+ "_mkldnn_max_pool2d",
1787
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) {
1788
+ return torch::mkldnn_max_pool2d(self, kernel_size, stride, padding, dilation, ceil_mode);
1789
+ })
1790
+ .define_singleton_method(
1791
+ "_mm",
1792
+ *[](const Tensor &self, const Tensor &mat2) {
1793
+ return torch::mm(self, mat2);
1794
+ })
1795
+ .define_singleton_method(
1796
+ "_mm_out",
1797
+ *[](const Tensor &self, const Tensor &mat2, Tensor &out) {
1798
+ return torch::mm_out(out, self, mat2);
1799
+ })
1800
+ .define_singleton_method(
1801
+ "_mode",
1802
+ *[](const Tensor &self, int64_t dim, bool keepdim) {
1803
+ return torch::mode(self, dim, keepdim);
1804
+ })
1805
+ .define_singleton_method(
1806
+ "_mode_values",
1807
+ *[](const Tensor &self, int64_t dim, bool keepdim, Tensor &values, Tensor &indices) {
1808
+ return torch::mode_out(values, indices, self, dim, keepdim);
1809
+ })
1810
+ .define_singleton_method(
1811
+ "_mul_out",
1812
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1813
+ return torch::mul_out(out, self, other);
1814
+ })
1815
+ .define_singleton_method(
1816
+ "_mul_scalar",
1817
+ *[](const Tensor &self, Scalar other) {
1818
+ return torch::mul(self, other);
1819
+ })
1820
+ .define_singleton_method(
1821
+ "_mul_tensor",
1822
+ *[](const Tensor &self, const Tensor &other) {
1823
+ return torch::mul(self, other);
1824
+ })
1825
+ .define_singleton_method(
1826
+ "_multinomial",
1827
+ *[](const Tensor &self, int64_t num_samples, bool replacement) {
1828
+ return torch::multinomial(self, num_samples, replacement);
1829
+ })
1830
+ .define_singleton_method(
1831
+ "_multinomial_out",
1832
+ *[](const Tensor &self, int64_t num_samples, bool replacement, Tensor &out) {
1833
+ return torch::multinomial_out(out, self, num_samples, replacement);
1834
+ })
1835
+ .define_singleton_method(
1836
+ "_mv",
1837
+ *[](const Tensor &self, const Tensor &vec) {
1838
+ return torch::mv(self, vec);
1839
+ })
1840
+ .define_singleton_method(
1841
+ "_mv_out",
1842
+ *[](const Tensor &self, const Tensor &vec, Tensor &out) {
1843
+ return torch::mv_out(out, self, vec);
1844
+ })
1845
+ .define_singleton_method(
1846
+ "_mvlgamma",
1847
+ *[](const Tensor &self, int64_t p) {
1848
+ return torch::mvlgamma(self, p);
1849
+ })
1850
+ .define_singleton_method(
1851
+ "_narrow",
1852
+ *[](Tensor &self, int64_t dim, int64_t start, int64_t length) {
1853
+ return torch::narrow(self, dim, start, length);
1854
+ })
1855
+ .define_singleton_method(
1856
+ "_native_batch_norm",
1857
+ *[](const Tensor &input, OptionalTensor weight, OptionalTensor bias, OptionalTensor running_mean, OptionalTensor running_var, bool training, double momentum, double eps) {
1858
+ return torch::native_batch_norm(input, weight, bias, running_mean, running_var, training, momentum, eps);
1859
+ })
1860
+ .define_singleton_method(
1861
+ "_native_layer_norm",
1862
+ *[](const Tensor &input, OptionalTensor weight, OptionalTensor bias, int64_t M, int64_t N, double eps) {
1863
+ return torch::native_layer_norm(input, weight, bias, M, N, eps);
1864
+ })
1865
+ .define_singleton_method(
1866
+ "_native_norm",
1867
+ *[](const Tensor &self, Scalar p) {
1868
+ return torch::native_norm(self, p);
1869
+ })
1870
+ .define_singleton_method(
1871
+ "_ne_scalar",
1872
+ *[](const Tensor &self, Scalar other) {
1873
+ return torch::ne(self, other);
1874
+ })
1875
+ .define_singleton_method(
1876
+ "_ne_scalar_out",
1877
+ *[](const Tensor &self, Scalar other, Tensor &out) {
1878
+ return torch::ne_out(out, self, other);
1879
+ })
1880
+ .define_singleton_method(
1881
+ "_ne_tensor",
1882
+ *[](const Tensor &self, const Tensor &other) {
1883
+ return torch::ne(self, other);
1884
+ })
1885
+ .define_singleton_method(
1886
+ "_ne_tensor_out",
1887
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
1888
+ return torch::ne_out(out, self, other);
1889
+ })
1890
+ .define_singleton_method(
1891
+ "_neg",
1892
+ *[](const Tensor &self) {
1893
+ return torch::neg(self);
1894
+ })
1895
+ .define_singleton_method(
1896
+ "_neg_",
1897
+ *[](Tensor &self) {
1898
+ return torch::neg_(self);
1899
+ })
1900
+ .define_singleton_method(
1901
+ "_neg_out",
1902
+ *[](const Tensor &self, Tensor &out) {
1903
+ return torch::neg_out(out, self);
1904
+ })
1905
+ .define_singleton_method(
1906
+ "_nonzero",
1907
+ *[](const Tensor &self) {
1908
+ return torch::nonzero(self);
1909
+ })
1910
+ .define_singleton_method(
1911
+ "_nonzero_numpy",
1912
+ *[](const Tensor &self) {
1913
+ return torch::nonzero_numpy(self);
1914
+ })
1915
+ .define_singleton_method(
1916
+ "_nonzero_out",
1917
+ *[](const Tensor &self, Tensor &out) {
1918
+ return torch::nonzero_out(out, self);
1919
+ })
1920
+ .define_singleton_method(
1921
+ "_norm_except_dim",
1922
+ *[](const Tensor &v, int64_t pow, int64_t dim) {
1923
+ return torch::norm_except_dim(v, pow, dim);
1924
+ })
1925
+ .define_singleton_method(
1926
+ "_norm_scalar",
1927
+ *[](const Tensor &self, Scalar p) {
1928
+ return torch::norm(self, p);
1929
+ })
1930
+ .define_singleton_method(
1931
+ "_nuclear_norm",
1932
+ *[](const Tensor &self, bool keepdim) {
1933
+ return torch::nuclear_norm(self, keepdim);
1934
+ })
1935
+ .define_singleton_method(
1936
+ "_nuclear_norm_dim",
1937
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim) {
1938
+ return torch::nuclear_norm(self, dim, keepdim);
1939
+ })
1940
+ .define_singleton_method(
1941
+ "_nuclear_norm_dim_out",
1942
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim, Tensor &out) {
1943
+ return torch::nuclear_norm_out(out, self, dim, keepdim);
1944
+ })
1945
+ .define_singleton_method(
1946
+ "_nuclear_norm_out",
1947
+ *[](const Tensor &self, bool keepdim, Tensor &out) {
1948
+ return torch::nuclear_norm_out(out, self, keepdim);
1949
+ })
1950
+ .define_singleton_method(
1951
+ "_numel",
1952
+ *[](const Tensor &self) {
1953
+ return torch::numel(self);
1954
+ })
1955
+ .define_singleton_method(
1956
+ "_ones_like",
1957
+ *[](const Tensor &self) {
1958
+ return torch::ones_like(self);
1959
+ })
1960
+ .define_singleton_method(
1961
+ "_ones_out",
1962
+ *[](IntArrayRef size, Tensor &out) {
1963
+ return torch::ones_out(out, size);
1964
+ })
1965
+ .define_singleton_method(
1966
+ "_orgqr",
1967
+ *[](const Tensor &self, const Tensor &input2) {
1968
+ return torch::orgqr(self, input2);
1969
+ })
1970
+ .define_singleton_method(
1971
+ "_orgqr_out",
1972
+ *[](const Tensor &self, const Tensor &input2, Tensor &out) {
1973
+ return torch::orgqr_out(out, self, input2);
1974
+ })
1975
+ .define_singleton_method(
1976
+ "_ormqr",
1977
+ *[](const Tensor &self, const Tensor &input2, const Tensor &input3, bool left, bool transpose) {
1978
+ return torch::ormqr(self, input2, input3, left, transpose);
1979
+ })
1980
+ .define_singleton_method(
1981
+ "_ormqr_out",
1982
+ *[](const Tensor &self, const Tensor &input2, const Tensor &input3, bool left, bool transpose, Tensor &out) {
1983
+ return torch::ormqr_out(out, self, input2, input3, left, transpose);
1984
+ })
1985
+ .define_singleton_method(
1986
+ "_pairwise_distance",
1987
+ *[](const Tensor &x1, const Tensor &x2, double p, double eps, bool keepdim) {
1988
+ return torch::pairwise_distance(x1, x2, p, eps, keepdim);
1989
+ })
1990
+ .define_singleton_method(
1991
+ "_pdist",
1992
+ *[](const Tensor &self, double p) {
1993
+ return torch::pdist(self, p);
1994
+ })
1995
+ .define_singleton_method(
1996
+ "_pinverse",
1997
+ *[](const Tensor &self, double rcond) {
1998
+ return torch::pinverse(self, rcond);
1999
+ })
2000
+ .define_singleton_method(
2001
+ "_pixel_shuffle",
2002
+ *[](const Tensor &self, int64_t upscale_factor) {
2003
+ return torch::pixel_shuffle(self, upscale_factor);
2004
+ })
2005
+ .define_singleton_method(
2006
+ "_poisson",
2007
+ *[](const Tensor &self) {
2008
+ return torch::poisson(self);
2009
+ })
2010
+ .define_singleton_method(
2011
+ "_poisson_nll_loss",
2012
+ *[](const Tensor &input, const Tensor &target, bool log_input, bool full, double eps, MyReduction reduction) {
2013
+ return torch::poisson_nll_loss(input, target, log_input, full, eps, reduction);
2014
+ })
2015
+ .define_singleton_method(
2016
+ "_polygamma",
2017
+ *[](int64_t n, const Tensor &self) {
2018
+ return torch::polygamma(n, self);
2019
+ })
2020
+ .define_singleton_method(
2021
+ "_polygamma_out",
2022
+ *[](int64_t n, const Tensor &self, Tensor &out) {
2023
+ return torch::polygamma_out(out, n, self);
2024
+ })
2025
+ .define_singleton_method(
2026
+ "_pow_scalar",
2027
+ *[](Scalar self, const Tensor &exponent) {
2028
+ return torch::pow(self, exponent);
2029
+ })
2030
+ .define_singleton_method(
2031
+ "_pow_scalar_out",
2032
+ *[](Scalar self, const Tensor &exponent, Tensor &out) {
2033
+ return torch::pow_out(out, self, exponent);
2034
+ })
2035
+ .define_singleton_method(
2036
+ "_pow_tensor_scalar",
2037
+ *[](const Tensor &self, Scalar exponent) {
2038
+ return torch::pow(self, exponent);
2039
+ })
2040
+ .define_singleton_method(
2041
+ "_pow_tensor_scalar_out",
2042
+ *[](const Tensor &self, Scalar exponent, Tensor &out) {
2043
+ return torch::pow_out(out, self, exponent);
2044
+ })
2045
+ .define_singleton_method(
2046
+ "_pow_tensor_tensor",
2047
+ *[](const Tensor &self, const Tensor &exponent) {
2048
+ return torch::pow(self, exponent);
2049
+ })
2050
+ .define_singleton_method(
2051
+ "_pow_tensor_tensor_out",
2052
+ *[](const Tensor &self, const Tensor &exponent, Tensor &out) {
2053
+ return torch::pow_out(out, self, exponent);
2054
+ })
2055
+ .define_singleton_method(
2056
+ "_prelu",
2057
+ *[](const Tensor &self, const Tensor &weight) {
2058
+ return torch::prelu(self, weight);
2059
+ })
2060
+ .define_singleton_method(
2061
+ "_q_per_channel_axis",
2062
+ *[](const Tensor &self) {
2063
+ return torch::q_per_channel_axis(self);
2064
+ })
2065
+ .define_singleton_method(
2066
+ "_q_per_channel_scales",
2067
+ *[](const Tensor &self) {
2068
+ return torch::q_per_channel_scales(self);
2069
+ })
2070
+ .define_singleton_method(
2071
+ "_q_per_channel_zero_points",
2072
+ *[](const Tensor &self) {
2073
+ return torch::q_per_channel_zero_points(self);
2074
+ })
2075
+ .define_singleton_method(
2076
+ "_q_scale",
2077
+ *[](const Tensor &self) {
2078
+ return torch::q_scale(self);
2079
+ })
2080
+ .define_singleton_method(
2081
+ "_q_zero_point",
2082
+ *[](const Tensor &self) {
2083
+ return torch::q_zero_point(self);
2084
+ })
2085
+ .define_singleton_method(
2086
+ "_qr",
2087
+ *[](const Tensor &self, bool some) {
2088
+ return torch::qr(self, some);
2089
+ })
2090
+ .define_singleton_method(
2091
+ "_qr_q",
2092
+ *[](const Tensor &self, bool some, Tensor &Q, Tensor &R) {
2093
+ return torch::qr_out(Q, R, self, some);
2094
+ })
2095
+ .define_singleton_method(
2096
+ "_quantized_gru_cell",
2097
+ *[](const Tensor &input, const Tensor &hx, const Tensor &w_ih, const Tensor &w_hh, const Tensor &b_ih, const Tensor &b_hh, const Tensor &packed_ih, const Tensor &packed_hh, const Tensor &col_offsets_ih, const Tensor &col_offsets_hh, Scalar scale_ih, Scalar scale_hh, Scalar zero_point_ih, Scalar zero_point_hh) {
2098
+ return torch::quantized_gru_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh);
2099
+ })
2100
+ .define_singleton_method(
2101
+ "_quantized_gru_data",
2102
+ *[](const Tensor &data, const Tensor &batch_sizes, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional) {
2103
+ return torch::quantized_gru(data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional);
2104
+ })
2105
+ .define_singleton_method(
2106
+ "_quantized_gru_input",
2107
+ *[](const Tensor &input, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional, bool batch_first) {
2108
+ return torch::quantized_gru(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first);
2109
+ })
2110
+ .define_singleton_method(
2111
+ "_quantized_lstm_cell",
2112
+ *[](const Tensor &input, TensorList hx, const Tensor &w_ih, const Tensor &w_hh, const Tensor &b_ih, const Tensor &b_hh, const Tensor &packed_ih, const Tensor &packed_hh, const Tensor &col_offsets_ih, const Tensor &col_offsets_hh, Scalar scale_ih, Scalar scale_hh, Scalar zero_point_ih, Scalar zero_point_hh) {
2113
+ return torch::quantized_lstm_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh);
2114
+ })
2115
+ .define_singleton_method(
2116
+ "_quantized_max_pool2d",
2117
+ *[](const Tensor &self, IntArrayRef kernel_size, IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) {
2118
+ return torch::quantized_max_pool2d(self, kernel_size, stride, padding, dilation, ceil_mode);
2119
+ })
2120
+ .define_singleton_method(
2121
+ "_quantized_rnn_relu_cell",
2122
+ *[](const Tensor &input, const Tensor &hx, const Tensor &w_ih, const Tensor &w_hh, const Tensor &b_ih, const Tensor &b_hh, const Tensor &packed_ih, const Tensor &packed_hh, const Tensor &col_offsets_ih, const Tensor &col_offsets_hh, Scalar scale_ih, Scalar scale_hh, Scalar zero_point_ih, Scalar zero_point_hh) {
2123
+ return torch::quantized_rnn_relu_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh);
2124
+ })
2125
+ .define_singleton_method(
2126
+ "_quantized_rnn_tanh_cell",
2127
+ *[](const Tensor &input, const Tensor &hx, const Tensor &w_ih, const Tensor &w_hh, const Tensor &b_ih, const Tensor &b_hh, const Tensor &packed_ih, const Tensor &packed_hh, const Tensor &col_offsets_ih, const Tensor &col_offsets_hh, Scalar scale_ih, Scalar scale_hh, Scalar zero_point_ih, Scalar zero_point_hh) {
2128
+ return torch::quantized_rnn_tanh_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh);
2129
+ })
2130
+ .define_singleton_method(
2131
+ "_rand_generator_out",
2132
+ *[](IntArrayRef size, Tensor &out) {
2133
+ return torch::rand_out(out, size);
2134
+ })
2135
+ .define_singleton_method(
2136
+ "_rand_like",
2137
+ *[](const Tensor &self) {
2138
+ return torch::rand_like(self);
2139
+ })
2140
+ .define_singleton_method(
2141
+ "_rand_out",
2142
+ *[](IntArrayRef size, Tensor &out) {
2143
+ return torch::rand_out(out, size);
2144
+ })
2145
+ .define_singleton_method(
2146
+ "_randint_generator_out",
2147
+ *[](int64_t high, IntArrayRef size, Tensor &out) {
2148
+ return torch::randint_out(out, high, size);
2149
+ })
2150
+ .define_singleton_method(
2151
+ "_randint_like",
2152
+ *[](const Tensor &self, int64_t high) {
2153
+ return torch::randint_like(self, high);
2154
+ })
2155
+ .define_singleton_method(
2156
+ "_randint_like_low",
2157
+ *[](const Tensor &self, int64_t low, int64_t high) {
2158
+ return torch::randint_like(self, low, high);
2159
+ })
2160
+ .define_singleton_method(
2161
+ "_randint_low_generator_out",
2162
+ *[](int64_t low, int64_t high, IntArrayRef size, Tensor &out) {
2163
+ return torch::randint_out(out, low, high, size);
2164
+ })
2165
+ .define_singleton_method(
2166
+ "_randint_low_out",
2167
+ *[](int64_t low, int64_t high, IntArrayRef size, Tensor &out) {
2168
+ return torch::randint_out(out, low, high, size);
2169
+ })
2170
+ .define_singleton_method(
2171
+ "_randint_out",
2172
+ *[](int64_t high, IntArrayRef size, Tensor &out) {
2173
+ return torch::randint_out(out, high, size);
2174
+ })
2175
+ .define_singleton_method(
2176
+ "_randn_generator_out",
2177
+ *[](IntArrayRef size, Tensor &out) {
2178
+ return torch::randn_out(out, size);
2179
+ })
2180
+ .define_singleton_method(
2181
+ "_randn_like",
2182
+ *[](const Tensor &self) {
2183
+ return torch::randn_like(self);
2184
+ })
2185
+ .define_singleton_method(
2186
+ "_randn_out",
2187
+ *[](IntArrayRef size, Tensor &out) {
2188
+ return torch::randn_out(out, size);
2189
+ })
2190
+ .define_singleton_method(
2191
+ "_randperm_generator_out",
2192
+ *[](int64_t n, Tensor &out) {
2193
+ return torch::randperm_out(out, n);
2194
+ })
2195
+ .define_singleton_method(
2196
+ "_randperm_out",
2197
+ *[](int64_t n, Tensor &out) {
2198
+ return torch::randperm_out(out, n);
2199
+ })
2200
+ .define_singleton_method(
2201
+ "_range_out",
2202
+ *[](Scalar start, Scalar end, Scalar step, Tensor &out) {
2203
+ return torch::range_out(out, start, end, step);
2204
+ })
2205
+ .define_singleton_method(
2206
+ "_reciprocal",
2207
+ *[](const Tensor &self) {
2208
+ return torch::reciprocal(self);
2209
+ })
2210
+ .define_singleton_method(
2211
+ "_reciprocal_",
2212
+ *[](Tensor &self) {
2213
+ return torch::reciprocal_(self);
2214
+ })
2215
+ .define_singleton_method(
2216
+ "_reciprocal_out",
2217
+ *[](const Tensor &self, Tensor &out) {
2218
+ return torch::reciprocal_out(out, self);
2219
+ })
2220
+ .define_singleton_method(
2221
+ "_relu",
2222
+ *[](const Tensor &self) {
2223
+ return torch::relu(self);
2224
+ })
2225
+ .define_singleton_method(
2226
+ "_relu_",
2227
+ *[](Tensor &self) {
2228
+ return torch::relu_(self);
2229
+ })
2230
+ .define_singleton_method(
2231
+ "_remainder_scalar",
2232
+ *[](const Tensor &self, Scalar other) {
2233
+ return torch::remainder(self, other);
2234
+ })
2235
+ .define_singleton_method(
2236
+ "_remainder_scalar_out",
2237
+ *[](const Tensor &self, Scalar other, Tensor &out) {
2238
+ return torch::remainder_out(out, self, other);
2239
+ })
2240
+ .define_singleton_method(
2241
+ "_remainder_tensor",
2242
+ *[](const Tensor &self, const Tensor &other) {
2243
+ return torch::remainder(self, other);
2244
+ })
2245
+ .define_singleton_method(
2246
+ "_remainder_tensor_out",
2247
+ *[](const Tensor &self, const Tensor &other, Tensor &out) {
2248
+ return torch::remainder_out(out, self, other);
2249
+ })
2250
+ .define_singleton_method(
2251
+ "_renorm",
2252
+ *[](const Tensor &self, Scalar p, int64_t dim, Scalar maxnorm) {
2253
+ return torch::renorm(self, p, dim, maxnorm);
2254
+ })
2255
+ .define_singleton_method(
2256
+ "_renorm_out",
2257
+ *[](const Tensor &self, Scalar p, int64_t dim, Scalar maxnorm, Tensor &out) {
2258
+ return torch::renorm_out(out, self, p, dim, maxnorm);
2259
+ })
2260
+ .define_singleton_method(
2261
+ "_repeat_interleave_self_int",
2262
+ *[](const Tensor &self, int64_t repeats) {
2263
+ return torch::repeat_interleave(self, repeats);
2264
+ })
2265
+ .define_singleton_method(
2266
+ "_repeat_interleave_self_int_dim",
2267
+ *[](const Tensor &self, int64_t repeats, int64_t dim) {
2268
+ return torch::repeat_interleave(self, repeats, dim);
2269
+ })
2270
+ .define_singleton_method(
2271
+ "_repeat_interleave_self_tensor",
2272
+ *[](const Tensor &self, const Tensor &repeats) {
2273
+ return torch::repeat_interleave(self, repeats);
2274
+ })
2275
+ .define_singleton_method(
2276
+ "_repeat_interleave_self_tensor_dim",
2277
+ *[](const Tensor &self, const Tensor &repeats, int64_t dim) {
2278
+ return torch::repeat_interleave(self, repeats, dim);
2279
+ })
2280
+ .define_singleton_method(
2281
+ "_repeat_interleave_tensor",
2282
+ *[](const Tensor &repeats) {
2283
+ return torch::repeat_interleave(repeats);
2284
+ })
2285
+ .define_singleton_method(
2286
+ "_reshape",
2287
+ *[](const Tensor &self, IntArrayRef shape) {
2288
+ return torch::reshape(self, shape);
2289
+ })
2290
+ .define_singleton_method(
2291
+ "_resize_as_",
2292
+ *[](Tensor &self, const Tensor &the_template) {
2293
+ return torch::resize_as_(self, the_template);
2294
+ })
2295
+ .define_singleton_method(
2296
+ "_result_type_scalar",
2297
+ *[](const Tensor &tensor, Scalar other) {
2298
+ return torch::result_type(tensor, other);
2299
+ })
2300
+ .define_singleton_method(
2301
+ "_result_type_scalar_scalar",
2302
+ *[](Scalar scalar1, Scalar scalar2) {
2303
+ return torch::result_type(scalar1, scalar2);
2304
+ })
2305
+ .define_singleton_method(
2306
+ "_result_type_scalar_tensor",
2307
+ *[](Scalar scalar, const Tensor &tensor) {
2308
+ return torch::result_type(scalar, tensor);
2309
+ })
2310
+ .define_singleton_method(
2311
+ "_result_type_tensor",
2312
+ *[](const Tensor &tensor, const Tensor &other) {
2313
+ return torch::result_type(tensor, other);
2314
+ })
2315
+ .define_singleton_method(
2316
+ "_rfft",
2317
+ *[](const Tensor &self, int64_t signal_ndim, bool normalized, bool onesided) {
2318
+ return torch::rfft(self, signal_ndim, normalized, onesided);
2319
+ })
2320
+ .define_singleton_method(
2321
+ "_rnn_relu_cell",
2322
+ *[](const Tensor &input, const Tensor &hx, const Tensor &w_ih, const Tensor &w_hh, OptionalTensor b_ih, OptionalTensor b_hh) {
2323
+ return torch::rnn_relu_cell(input, hx, w_ih, w_hh, b_ih, b_hh);
2324
+ })
2325
+ .define_singleton_method(
2326
+ "_rnn_relu_data",
2327
+ *[](const Tensor &data, const Tensor &batch_sizes, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional) {
2328
+ return torch::rnn_relu(data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional);
2329
+ })
2330
+ .define_singleton_method(
2331
+ "_rnn_relu_input",
2332
+ *[](const Tensor &input, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional, bool batch_first) {
2333
+ return torch::rnn_relu(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first);
2334
+ })
2335
+ .define_singleton_method(
2336
+ "_rnn_tanh_cell",
2337
+ *[](const Tensor &input, const Tensor &hx, const Tensor &w_ih, const Tensor &w_hh, OptionalTensor b_ih, OptionalTensor b_hh) {
2338
+ return torch::rnn_tanh_cell(input, hx, w_ih, w_hh, b_ih, b_hh);
2339
+ })
2340
+ .define_singleton_method(
2341
+ "_rnn_tanh_data",
2342
+ *[](const Tensor &data, const Tensor &batch_sizes, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional) {
2343
+ return torch::rnn_tanh(data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional);
2344
+ })
2345
+ .define_singleton_method(
2346
+ "_rnn_tanh_input",
2347
+ *[](const Tensor &input, const Tensor &hx, TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional, bool batch_first) {
2348
+ return torch::rnn_tanh(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first);
2349
+ })
2350
+ .define_singleton_method(
2351
+ "_roll",
2352
+ *[](const Tensor &self, IntArrayRef shifts, IntArrayRef dims) {
2353
+ return torch::roll(self, shifts, dims);
2354
+ })
2355
+ .define_singleton_method(
2356
+ "_rot90",
2357
+ *[](const Tensor &self, int64_t k, IntArrayRef dims) {
2358
+ return torch::rot90(self, k, dims);
2359
+ })
2360
+ .define_singleton_method(
2361
+ "_round",
2362
+ *[](const Tensor &self) {
2363
+ return torch::round(self);
2364
+ })
2365
+ .define_singleton_method(
2366
+ "_round_",
2367
+ *[](Tensor &self) {
2368
+ return torch::round_(self);
2369
+ })
2370
+ .define_singleton_method(
2371
+ "_round_out",
2372
+ *[](const Tensor &self, Tensor &out) {
2373
+ return torch::round_out(out, self);
2374
+ })
2375
+ .define_singleton_method(
2376
+ "_rrelu",
2377
+ *[](const Tensor &self, Scalar lower, Scalar upper, bool training) {
2378
+ return torch::rrelu(self, lower, upper, training);
2379
+ })
2380
+ .define_singleton_method(
2381
+ "_rrelu_",
2382
+ *[](Tensor &self, Scalar lower, Scalar upper, bool training) {
2383
+ return torch::rrelu_(self, lower, upper, training);
2384
+ })
2385
+ .define_singleton_method(
2386
+ "_rsqrt",
2387
+ *[](const Tensor &self) {
2388
+ return torch::rsqrt(self);
2389
+ })
2390
+ .define_singleton_method(
2391
+ "_rsqrt_",
2392
+ *[](Tensor &self) {
2393
+ return torch::rsqrt_(self);
2394
+ })
2395
+ .define_singleton_method(
2396
+ "_rsqrt_out",
2397
+ *[](const Tensor &self, Tensor &out) {
2398
+ return torch::rsqrt_out(out, self);
2399
+ })
2400
+ .define_singleton_method(
2401
+ "_rsub_scalar",
2402
+ *[](const Tensor &self, Scalar other, Scalar alpha) {
2403
+ return torch::rsub(self, other, alpha);
2404
+ })
2405
+ .define_singleton_method(
2406
+ "_rsub_tensor",
2407
+ *[](const Tensor &self, const Tensor &other, Scalar alpha) {
2408
+ return torch::rsub(self, other, alpha);
2409
+ })
2410
+ .define_singleton_method(
2411
+ "_scatter_add",
2412
+ *[](const Tensor &self, int64_t dim, const Tensor &index, const Tensor &src) {
2413
+ return torch::scatter_add(self, dim, index, src);
2414
+ })
2415
+ .define_singleton_method(
2416
+ "_scatter_src",
2417
+ *[](const Tensor &self, int64_t dim, const Tensor &index, const Tensor &src) {
2418
+ return torch::scatter(self, dim, index, src);
2419
+ })
2420
+ .define_singleton_method(
2421
+ "_scatter_value",
2422
+ *[](const Tensor &self, int64_t dim, const Tensor &index, Scalar value) {
2423
+ return torch::scatter(self, dim, index, value);
2424
+ })
2425
+ .define_singleton_method(
2426
+ "_select_int",
2427
+ *[](Tensor &self, int64_t dim, int64_t index) {
2428
+ return torch::select(self, dim, index);
2429
+ })
2430
+ .define_singleton_method(
2431
+ "_selu",
2432
+ *[](const Tensor &self) {
2433
+ return torch::selu(self);
2434
+ })
2435
+ .define_singleton_method(
2436
+ "_selu_",
2437
+ *[](Tensor &self) {
2438
+ return torch::selu_(self);
2439
+ })
2440
+ .define_singleton_method(
2441
+ "_sigmoid",
2442
+ *[](const Tensor &self) {
2443
+ return torch::sigmoid(self);
2444
+ })
2445
+ .define_singleton_method(
2446
+ "_sigmoid_",
2447
+ *[](Tensor &self) {
2448
+ return torch::sigmoid_(self);
2449
+ })
2450
+ .define_singleton_method(
2451
+ "_sigmoid_out",
2452
+ *[](const Tensor &self, Tensor &out) {
2453
+ return torch::sigmoid_out(out, self);
2454
+ })
2455
+ .define_singleton_method(
2456
+ "_sign",
2457
+ *[](const Tensor &self) {
2458
+ return torch::sign(self);
2459
+ })
2460
+ .define_singleton_method(
2461
+ "_sign_out",
2462
+ *[](const Tensor &self, Tensor &out) {
2463
+ return torch::sign_out(out, self);
2464
+ })
2465
+ .define_singleton_method(
2466
+ "_sin",
2467
+ *[](const Tensor &self) {
2468
+ return torch::sin(self);
2469
+ })
2470
+ .define_singleton_method(
2471
+ "_sin_",
2472
+ *[](Tensor &self) {
2473
+ return torch::sin_(self);
2474
+ })
2475
+ .define_singleton_method(
2476
+ "_sin_out",
2477
+ *[](const Tensor &self, Tensor &out) {
2478
+ return torch::sin_out(out, self);
2479
+ })
2480
+ .define_singleton_method(
2481
+ "_sinh",
2482
+ *[](const Tensor &self) {
2483
+ return torch::sinh(self);
2484
+ })
2485
+ .define_singleton_method(
2486
+ "_sinh_",
2487
+ *[](Tensor &self) {
2488
+ return torch::sinh_(self);
2489
+ })
2490
+ .define_singleton_method(
2491
+ "_sinh_out",
2492
+ *[](const Tensor &self, Tensor &out) {
2493
+ return torch::sinh_out(out, self);
2494
+ })
2495
+ .define_singleton_method(
2496
+ "_size_int",
2497
+ *[](const Tensor &self, int64_t dim) {
2498
+ return torch::size(self, dim);
2499
+ })
2500
+ .define_singleton_method(
2501
+ "_slice_tensor",
2502
+ *[](Tensor &self, int64_t dim, int64_t start, int64_t end, int64_t step) {
2503
+ return torch::slice(self, dim, start, end, step);
2504
+ })
2505
+ .define_singleton_method(
2506
+ "_slogdet",
2507
+ *[](const Tensor &self) {
2508
+ return torch::slogdet(self);
2509
+ })
2510
+ .define_singleton_method(
2511
+ "_smm",
2512
+ *[](const Tensor &self, const Tensor &mat2) {
2513
+ return torch::smm(self, mat2);
2514
+ })
2515
+ .define_singleton_method(
2516
+ "_solve",
2517
+ *[](const Tensor &self, const Tensor &A) {
2518
+ return torch::solve(self, A);
2519
+ })
2520
+ .define_singleton_method(
2521
+ "_solve_solution",
2522
+ *[](const Tensor &self, const Tensor &A, Tensor &solution, Tensor &lu) {
2523
+ return torch::solve_out(solution, lu, self, A);
2524
+ })
2525
+ .define_singleton_method(
2526
+ "_sort",
2527
+ *[](const Tensor &self, int64_t dim, bool descending) {
2528
+ return torch::sort(self, dim, descending);
2529
+ })
2530
+ .define_singleton_method(
2531
+ "_sort_values",
2532
+ *[](const Tensor &self, int64_t dim, bool descending, Tensor &values, Tensor &indices) {
2533
+ return torch::sort_out(values, indices, self, dim, descending);
2534
+ })
2535
+ .define_singleton_method(
2536
+ "_split_tensor",
2537
+ *[](Tensor &self, int64_t split_size, int64_t dim) {
2538
+ return torch::split(self, split_size, dim);
2539
+ })
2540
+ .define_singleton_method(
2541
+ "_split_with_sizes",
2542
+ *[](const Tensor &self, IntArrayRef split_sizes, int64_t dim) {
2543
+ return torch::split_with_sizes(self, split_sizes, dim);
2544
+ })
2545
+ .define_singleton_method(
2546
+ "_sqrt",
2547
+ *[](const Tensor &self) {
2548
+ return torch::sqrt(self);
2549
+ })
2550
+ .define_singleton_method(
2551
+ "_sqrt_",
2552
+ *[](Tensor &self) {
2553
+ return torch::sqrt_(self);
2554
+ })
2555
+ .define_singleton_method(
2556
+ "_sqrt_out",
2557
+ *[](const Tensor &self, Tensor &out) {
2558
+ return torch::sqrt_out(out, self);
2559
+ })
2560
+ .define_singleton_method(
2561
+ "_squeeze",
2562
+ *[](Tensor &self) {
2563
+ return torch::squeeze(self);
2564
+ })
2565
+ .define_singleton_method(
2566
+ "_squeeze_dim",
2567
+ *[](Tensor &self, int64_t dim) {
2568
+ return torch::squeeze(self, dim);
2569
+ })
2570
+ .define_singleton_method(
2571
+ "_sspaddmm",
2572
+ *[](const Tensor &self, const Tensor &mat1, const Tensor &mat2, Scalar beta, Scalar alpha) {
2573
+ return torch::sspaddmm(self, mat1, mat2, beta, alpha);
2574
+ })
2575
+ .define_singleton_method(
2576
+ "_sspaddmm_out",
2577
+ *[](const Tensor &self, const Tensor &mat1, const Tensor &mat2, Scalar beta, Scalar alpha, Tensor &out) {
2578
+ return torch::sspaddmm_out(out, self, mat1, mat2, beta, alpha);
2579
+ })
2580
+ .define_singleton_method(
2581
+ "_stack",
2582
+ *[](TensorList tensors, int64_t dim) {
2583
+ return torch::stack(tensors, dim);
2584
+ })
2585
+ .define_singleton_method(
2586
+ "_stack_out",
2587
+ *[](TensorList tensors, int64_t dim, Tensor &out) {
2588
+ return torch::stack_out(out, tensors, dim);
2589
+ })
2590
+ .define_singleton_method(
2591
+ "_std",
2592
+ *[](const Tensor &self, bool unbiased) {
2593
+ return torch::std(self, unbiased);
2594
+ })
2595
+ .define_singleton_method(
2596
+ "_std_dim",
2597
+ *[](const Tensor &self, IntArrayRef dim, bool unbiased, bool keepdim) {
2598
+ return torch::std(self, dim, unbiased, keepdim);
2599
+ })
2600
+ .define_singleton_method(
2601
+ "_std_mean",
2602
+ *[](const Tensor &self, bool unbiased) {
2603
+ return torch::std_mean(self, unbiased);
2604
+ })
2605
+ .define_singleton_method(
2606
+ "_std_mean_dim",
2607
+ *[](const Tensor &self, IntArrayRef dim, bool unbiased, bool keepdim) {
2608
+ return torch::std_mean(self, dim, unbiased, keepdim);
2609
+ })
2610
+ .define_singleton_method(
2611
+ "_std_out",
2612
+ *[](const Tensor &self, IntArrayRef dim, bool unbiased, bool keepdim, Tensor &out) {
2613
+ return torch::std_out(out, self, dim, unbiased, keepdim);
2614
+ })
2615
+ .define_singleton_method(
2616
+ "_stride_int",
2617
+ *[](const Tensor &self, int64_t dim) {
2618
+ return torch::stride(self, dim);
2619
+ })
2620
+ .define_singleton_method(
2621
+ "_sub_out",
2622
+ *[](const Tensor &self, const Tensor &other, Scalar alpha, Tensor &out) {
2623
+ return torch::sub_out(out, self, other, alpha);
2624
+ })
2625
+ .define_singleton_method(
2626
+ "_sub_scalar",
2627
+ *[](const Tensor &self, Scalar other, Scalar alpha) {
2628
+ return torch::sub(self, other, alpha);
2629
+ })
2630
+ .define_singleton_method(
2631
+ "_sub_tensor",
2632
+ *[](const Tensor &self, const Tensor &other, Scalar alpha) {
2633
+ return torch::sub(self, other, alpha);
2634
+ })
2635
+ .define_singleton_method(
2636
+ "_svd",
2637
+ *[](const Tensor &self, bool some, bool compute_uv) {
2638
+ return torch::svd(self, some, compute_uv);
2639
+ })
2640
+ .define_singleton_method(
2641
+ "_svd_u",
2642
+ *[](const Tensor &self, bool some, bool compute_uv, Tensor &U, Tensor &S, Tensor &V) {
2643
+ return torch::svd_out(U, S, V, self, some, compute_uv);
2644
+ })
2645
+ .define_singleton_method(
2646
+ "_symeig",
2647
+ *[](const Tensor &self, bool eigenvectors, bool upper) {
2648
+ return torch::symeig(self, eigenvectors, upper);
2649
+ })
2650
+ .define_singleton_method(
2651
+ "_symeig_e",
2652
+ *[](const Tensor &self, bool eigenvectors, bool upper, Tensor &e, Tensor &V) {
2653
+ return torch::symeig_out(e, V, self, eigenvectors, upper);
2654
+ })
2655
+ .define_singleton_method(
2656
+ "_t",
2657
+ *[](Tensor &self) {
2658
+ return torch::t(self);
2659
+ })
2660
+ .define_singleton_method(
2661
+ "_take",
2662
+ *[](const Tensor &self, const Tensor &index) {
2663
+ return torch::take(self, index);
2664
+ })
2665
+ .define_singleton_method(
2666
+ "_take_out",
2667
+ *[](const Tensor &self, const Tensor &index, Tensor &out) {
2668
+ return torch::take_out(out, self, index);
2669
+ })
2670
+ .define_singleton_method(
2671
+ "_tan",
2672
+ *[](const Tensor &self) {
2673
+ return torch::tan(self);
2674
+ })
2675
+ .define_singleton_method(
2676
+ "_tan_",
2677
+ *[](Tensor &self) {
2678
+ return torch::tan_(self);
2679
+ })
2680
+ .define_singleton_method(
2681
+ "_tan_out",
2682
+ *[](const Tensor &self, Tensor &out) {
2683
+ return torch::tan_out(out, self);
2684
+ })
2685
+ .define_singleton_method(
2686
+ "_tanh",
2687
+ *[](const Tensor &self) {
2688
+ return torch::tanh(self);
2689
+ })
2690
+ .define_singleton_method(
2691
+ "_tanh_",
2692
+ *[](Tensor &self) {
2693
+ return torch::tanh_(self);
2694
+ })
2695
+ .define_singleton_method(
2696
+ "_tanh_out",
2697
+ *[](const Tensor &self, Tensor &out) {
2698
+ return torch::tanh_out(out, self);
2699
+ })
2700
+ .define_singleton_method(
2701
+ "_tensordot",
2702
+ *[](const Tensor &self, const Tensor &other, IntArrayRef dims_self, IntArrayRef dims_other) {
2703
+ return torch::tensordot(self, other, dims_self, dims_other);
2704
+ })
2705
+ .define_singleton_method(
2706
+ "_threshold",
2707
+ *[](const Tensor &self, Scalar threshold, Scalar value) {
2708
+ return torch::threshold(self, threshold, value);
2709
+ })
2710
+ .define_singleton_method(
2711
+ "_threshold_",
2712
+ *[](Tensor &self, Scalar threshold, Scalar value) {
2713
+ return torch::threshold_(self, threshold, value);
2714
+ })
2715
+ .define_singleton_method(
2716
+ "_threshold_out",
2717
+ *[](const Tensor &self, Scalar threshold, Scalar value, Tensor &out) {
2718
+ return torch::threshold_out(out, self, threshold, value);
2719
+ })
2720
+ .define_singleton_method(
2721
+ "_topk",
2722
+ *[](const Tensor &self, int64_t k, int64_t dim, bool largest, bool sorted) {
2723
+ return torch::topk(self, k, dim, largest, sorted);
2724
+ })
2725
+ .define_singleton_method(
2726
+ "_topk_values",
2727
+ *[](const Tensor &self, int64_t k, int64_t dim, bool largest, bool sorted, Tensor &values, Tensor &indices) {
2728
+ return torch::topk_out(values, indices, self, k, dim, largest, sorted);
2729
+ })
2730
+ .define_singleton_method(
2731
+ "_trace",
2732
+ *[](const Tensor &self) {
2733
+ return torch::trace(self);
2734
+ })
2735
+ .define_singleton_method(
2736
+ "_transpose_int",
2737
+ *[](Tensor &self, int64_t dim0, int64_t dim1) {
2738
+ return torch::transpose(self, dim0, dim1);
2739
+ })
2740
+ .define_singleton_method(
2741
+ "_trapz_dx",
2742
+ *[](const Tensor &y, double dx, int64_t dim) {
2743
+ return torch::trapz(y, dx, dim);
2744
+ })
2745
+ .define_singleton_method(
2746
+ "_trapz_x",
2747
+ *[](const Tensor &y, const Tensor &x, int64_t dim) {
2748
+ return torch::trapz(y, x, dim);
2749
+ })
2750
+ .define_singleton_method(
2751
+ "_triangular_solve",
2752
+ *[](const Tensor &self, const Tensor &A, bool upper, bool transpose, bool unitriangular) {
2753
+ return torch::triangular_solve(self, A, upper, transpose, unitriangular);
2754
+ })
2755
+ .define_singleton_method(
2756
+ "_triangular_solve_x",
2757
+ *[](const Tensor &self, const Tensor &A, bool upper, bool transpose, bool unitriangular, Tensor &X, Tensor &M) {
2758
+ return torch::triangular_solve_out(X, M, self, A, upper, transpose, unitriangular);
2759
+ })
2760
+ .define_singleton_method(
2761
+ "_tril",
2762
+ *[](const Tensor &self, int64_t diagonal) {
2763
+ return torch::tril(self, diagonal);
2764
+ })
2765
+ .define_singleton_method(
2766
+ "_tril_out",
2767
+ *[](const Tensor &self, int64_t diagonal, Tensor &out) {
2768
+ return torch::tril_out(out, self, diagonal);
2769
+ })
2770
+ .define_singleton_method(
2771
+ "_triplet_margin_loss",
2772
+ *[](const Tensor &anchor, const Tensor &positive, const Tensor &negative, double margin, double p, double eps, bool swap, MyReduction reduction) {
2773
+ return torch::triplet_margin_loss(anchor, positive, negative, margin, p, eps, swap, reduction);
2774
+ })
2775
+ .define_singleton_method(
2776
+ "_triu",
2777
+ *[](const Tensor &self, int64_t diagonal) {
2778
+ return torch::triu(self, diagonal);
2779
+ })
2780
+ .define_singleton_method(
2781
+ "_triu_out",
2782
+ *[](const Tensor &self, int64_t diagonal, Tensor &out) {
2783
+ return torch::triu_out(out, self, diagonal);
2784
+ })
2785
+ .define_singleton_method(
2786
+ "_trunc",
2787
+ *[](const Tensor &self) {
2788
+ return torch::trunc(self);
2789
+ })
2790
+ .define_singleton_method(
2791
+ "_trunc_",
2792
+ *[](Tensor &self) {
2793
+ return torch::trunc_(self);
2794
+ })
2795
+ .define_singleton_method(
2796
+ "_trunc_out",
2797
+ *[](const Tensor &self, Tensor &out) {
2798
+ return torch::trunc_out(out, self);
2799
+ })
2800
+ .define_singleton_method(
2801
+ "_unbind_int",
2802
+ *[](Tensor &self, int64_t dim) {
2803
+ return torch::unbind(self, dim);
2804
+ })
2805
+ .define_singleton_method(
2806
+ "_unique_consecutive",
2807
+ *[](const Tensor &self, bool return_inverse, bool return_counts) {
2808
+ return torch::unique_consecutive(self, return_inverse, return_counts);
2809
+ })
2810
+ .define_singleton_method(
2811
+ "_unique_consecutive_dim",
2812
+ *[](const Tensor &self, bool return_inverse, bool return_counts, int64_t dim) {
2813
+ return torch::unique_consecutive(self, return_inverse, return_counts, dim);
2814
+ })
2815
+ .define_singleton_method(
2816
+ "_unique_dim",
2817
+ *[](const Tensor &self, int64_t dim, bool sorted, bool return_inverse, bool return_counts) {
2818
+ return torch::unique_dim(self, dim, sorted, return_inverse, return_counts);
2819
+ })
2820
+ .define_singleton_method(
2821
+ "_unsqueeze",
2822
+ *[](Tensor &self, int64_t dim) {
2823
+ return torch::unsqueeze(self, dim);
2824
+ })
2825
+ .define_singleton_method(
2826
+ "_var",
2827
+ *[](const Tensor &self, bool unbiased) {
2828
+ return torch::var(self, unbiased);
2829
+ })
2830
+ .define_singleton_method(
2831
+ "_var_dim",
2832
+ *[](const Tensor &self, IntArrayRef dim, bool unbiased, bool keepdim) {
2833
+ return torch::var(self, dim, unbiased, keepdim);
2834
+ })
2835
+ .define_singleton_method(
2836
+ "_var_mean",
2837
+ *[](const Tensor &self, bool unbiased) {
2838
+ return torch::var_mean(self, unbiased);
2839
+ })
2840
+ .define_singleton_method(
2841
+ "_var_mean_dim",
2842
+ *[](const Tensor &self, IntArrayRef dim, bool unbiased, bool keepdim) {
2843
+ return torch::var_mean(self, dim, unbiased, keepdim);
2844
+ })
2845
+ .define_singleton_method(
2846
+ "_var_out",
2847
+ *[](const Tensor &self, IntArrayRef dim, bool unbiased, bool keepdim, Tensor &out) {
2848
+ return torch::var_out(out, self, dim, unbiased, keepdim);
2849
+ })
2850
+ .define_singleton_method(
2851
+ "_where",
2852
+ *[](const Tensor &condition) {
2853
+ return torch::where(condition);
2854
+ })
2855
+ .define_singleton_method(
2856
+ "_where_self",
2857
+ *[](const Tensor &condition, const Tensor &self, const Tensor &other) {
2858
+ return torch::where(condition, self, other);
2859
+ })
2860
+ .define_singleton_method(
2861
+ "_zero_",
2862
+ *[](Tensor &self) {
2863
+ return torch::zero_(self);
2864
+ })
2865
+ .define_singleton_method(
2866
+ "_zeros_like",
2867
+ *[](const Tensor &self) {
2868
+ return torch::zeros_like(self);
2869
+ })
2870
+ .define_singleton_method(
2871
+ "_zeros_out",
2872
+ *[](IntArrayRef size, Tensor &out) {
2873
+ return torch::zeros_out(out, size);
2874
+ });
2875
+ }