ext/torch/tensor_functions.cpp in torch-rb-0.1.5 vs ext/torch/tensor_functions.cpp in torch-rb-0.1.6
- old
+ new
@@ -361,10 +361,20 @@
"_cosh_",
*[](Tensor &self) {
return self.cosh_();
})
.define_method(
+ "_cumprod",
+ *[](const Tensor &self, int64_t dim, OptionalScalarType dtype) {
+ return self.cumprod(dim, dtype);
+ })
+ .define_method(
+ "_cumsum",
+ *[](const Tensor &self, int64_t dim, OptionalScalarType dtype) {
+ return self.cumsum(dim, dtype);
+ })
+ .define_method(
"_data",
*[](const Tensor &self) {
return self.data();
})
.define_method(
@@ -453,11 +463,11 @@
return self.dot(tensor);
})
.define_method(
"_eig",
*[](const Tensor &self, bool eigenvectors) {
- return self.eig(eigenvectors);
+ return wrap(self.eig(eigenvectors));
})
.define_method(
"_eq__scalar",
*[](Tensor &self, Scalar other) {
return self.eq_(other);
@@ -648,11 +658,11 @@
return self.geometric_(p);
})
.define_method(
"_geqrf",
*[](const Tensor &self) {
- return self.geqrf();
+ return wrap(self.geqrf());
})
.define_method(
"_ger",
*[](const Tensor &self, const Tensor &vec2) {
return self.ger(vec2);
@@ -818,11 +828,11 @@
return self.item();
})
.define_method(
"_kthvalue",
*[](const Tensor &self, int64_t k, int64_t dim, bool keepdim) {
- return self.kthvalue(k, dim, keepdim);
+ return wrap(self.kthvalue(k, dim, keepdim));
})
.define_method(
"_le__scalar",
*[](Tensor &self, Scalar other) {
return self.le_(other);
@@ -916,10 +926,15 @@
"_log_normal_",
*[](Tensor &self, double mean, double std) {
return self.log_normal_(mean, std);
})
.define_method(
+ "_log_softmax",
+ *[](const Tensor &self, int64_t dim, OptionalScalarType dtype) {
+ return self.log_softmax(dim, dtype);
+ })
+ .define_method(
"_logdet",
*[](const Tensor &self) {
return self.logdet();
})
.define_method(
@@ -948,11 +963,11 @@
return self.logsumexp(dim, keepdim);
})
.define_method(
"_lstsq",
*[](const Tensor &self, const Tensor &A) {
- return self.lstsq(A);
+ return wrap(self.lstsq(A));
})
.define_method(
"_lt__scalar",
*[](Tensor &self, Scalar other) {
return self.lt_(other);
@@ -1028,11 +1043,11 @@
return self.max();
})
.define_method(
"_max_dim",
*[](const Tensor &self, int64_t dim, bool keepdim) {
- return self.max(dim, keepdim);
+ return wrap(self.max(dim, keepdim));
})
.define_method(
"_max_other",
*[](const Tensor &self, const Tensor &other) {
return self.max(other);
@@ -1041,28 +1056,38 @@
"_max_values",
*[](const Tensor &self, IntArrayRef dim, bool keepdim) {
return self.max_values(dim, keepdim);
})
.define_method(
+ "_mean",
+ *[](const Tensor &self, OptionalScalarType dtype) {
+ return self.mean(dtype);
+ })
+ .define_method(
+ "_mean_dim",
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim, OptionalScalarType dtype) {
+ return self.mean(dim, keepdim, dtype);
+ })
+ .define_method(
"_median",
*[](const Tensor &self) {
return self.median();
})
.define_method(
"_median_dim",
*[](const Tensor &self, int64_t dim, bool keepdim) {
- return self.median(dim, keepdim);
+ return wrap(self.median(dim, keepdim));
})
.define_method(
"_min",
*[](const Tensor &self) {
return self.min();
})
.define_method(
"_min_dim",
*[](const Tensor &self, int64_t dim, bool keepdim) {
- return self.min(dim, keepdim);
+ return wrap(self.min(dim, keepdim));
})
.define_method(
"_min_other",
*[](const Tensor &self, const Tensor &other) {
return self.min(other);
@@ -1078,11 +1103,11 @@
return self.mm(mat2);
})
.define_method(
"_mode",
*[](const Tensor &self, int64_t dim, bool keepdim) {
- return self.mode(dim, keepdim);
+ return wrap(self.mode(dim, keepdim));
})
.define_method(
"_mul__scalar",
*[](Tensor &self, Scalar other) {
return self.mul_(other);
@@ -1256,10 +1281,20 @@
"_prelu",
*[](const Tensor &self, const Tensor &weight) {
return self.prelu(weight);
})
.define_method(
+ "_prod",
+ *[](const Tensor &self, OptionalScalarType dtype) {
+ return self.prod(dtype);
+ })
+ .define_method(
+ "_prod_dim_int",
+ *[](const Tensor &self, int64_t dim, bool keepdim, OptionalScalarType dtype) {
+ return self.prod(dim, keepdim, dtype);
+ })
+ .define_method(
"_put_",
*[](Tensor &self, const Tensor &index, const Tensor &source, bool accumulate) {
return self.put_(index, source, accumulate);
})
.define_method(
@@ -1288,11 +1323,11 @@
return self.q_zero_point();
})
.define_method(
"_qr",
*[](const Tensor &self, bool some) {
- return self.qr(some);
+ return wrap(self.qr(some));
})
.define_method(
"_qscheme",
*[](const Tensor &self) {
return self.qscheme();
@@ -1543,26 +1578,31 @@
return self.slice(dim, start, end, step);
})
.define_method(
"_slogdet",
*[](const Tensor &self) {
- return self.slogdet();
+ return wrap(self.slogdet());
})
.define_method(
"_smm",
*[](const Tensor &self, const Tensor &mat2) {
return self.smm(mat2);
})
.define_method(
+ "_softmax",
+ *[](const Tensor &self, int64_t dim, OptionalScalarType dtype) {
+ return self.softmax(dim, dtype);
+ })
+ .define_method(
"_solve",
*[](const Tensor &self, const Tensor &A) {
- return self.solve(A);
+ return wrap(self.solve(A));
})
.define_method(
"_sort",
*[](const Tensor &self, int64_t dim, bool descending) {
- return self.sort(dim, descending);
+ return wrap(self.sort(dim, descending));
})
.define_method(
"_sparse_dim",
*[](const Tensor &self) {
return self.sparse_dim();
@@ -1661,23 +1701,33 @@
"_sub_tensor",
*[](const Tensor &self, const Tensor &other, Scalar alpha) {
return self.sub(other, alpha);
})
.define_method(
+ "_sum",
+ *[](const Tensor &self, OptionalScalarType dtype) {
+ return self.sum(dtype);
+ })
+ .define_method(
+ "_sum_dim_intlist",
+ *[](const Tensor &self, IntArrayRef dim, bool keepdim, OptionalScalarType dtype) {
+ return self.sum(dim, keepdim, dtype);
+ })
+ .define_method(
"_sum_to_size",
*[](const Tensor &self, IntArrayRef size) {
return self.sum_to_size(size);
})
.define_method(
"_svd",
*[](const Tensor &self, bool some, bool compute_uv) {
- return self.svd(some, compute_uv);
+ return wrap(self.svd(some, compute_uv));
})
.define_method(
"_symeig",
*[](const Tensor &self, bool eigenvectors, bool upper) {
- return self.symeig(eigenvectors, upper);
+ return wrap(self.symeig(eigenvectors, upper));
})
.define_method(
"_t",
*[](Tensor &self) {
return self.t();
@@ -1716,10 +1766,20 @@
"_to_dense",
*[](const Tensor &self) {
return self.to_dense();
})
.define_method(
+ "_to_device",
+ *[](const Tensor &self, Device device, ScalarType dtype, bool non_blocking, bool copy) {
+ return self.to(device, dtype, non_blocking, copy);
+ })
+ .define_method(
+ "_to_dtype",
+ *[](const Tensor &self, ScalarType dtype, bool non_blocking, bool copy) {
+ return self.to(dtype, non_blocking, copy);
+ })
+ .define_method(
"_to_mkldnn",
*[](const Tensor &self) {
return self.to_mkldnn();
})
.define_method(
@@ -1738,11 +1798,11 @@
return self.to_sparse(sparse_dim);
})
.define_method(
"_topk",
*[](const Tensor &self, int64_t k, int64_t dim, bool largest, bool sorted) {
- return self.topk(k, dim, largest, sorted);
+ return wrap(self.topk(k, dim, largest, sorted));
})
.define_method(
"_trace",
*[](const Tensor &self) {
return self.trace();
@@ -1758,10 +1818,10 @@
return self.transpose(dim0, dim1);
})
.define_method(
"_triangular_solve",
*[](const Tensor &self, const Tensor &A, bool upper, bool transpose, bool unitriangular) {
- return self.triangular_solve(A, upper, transpose, unitriangular);
+ return wrap(self.triangular_solve(A, upper, transpose, unitriangular));
})
.define_method(
"_tril",
*[](const Tensor &self, int64_t diagonal) {
return self.tril(diagonal);