torch-rb 0.1.1 → 0.1.6

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