@@ -67,6 +67,14 @@ TORCH_META_FUNC(atan2) (const Tensor& self, const Tensor& other) {
6767 build_binary_float_op (maybe_get_output (), self, other);
6868}
6969
70+ // These are normal binary ops that preserve dtype
71+ #define CREATE_BINARY_META_FUNC (func ) \
72+ TORCH_META_FUNC (func) (const Tensor& self, const Tensor& other) { \
73+ build_binary_op (maybe_get_output (), self, other); \
74+ }
75+
76+ CREATE_BINARY_META_FUNC (gcd);
77+
7078} // namespace meta
7179
7280
@@ -198,6 +206,13 @@ TORCH_IMPL_FUNC(special_xlog1py_out) (const Tensor& self, const Tensor& other, c
198206 xlog1py_stub (device_type (), *this );
199207}
200208
209+ #define CREATE_BINARY_TORCH_IMPL_FUNC (func ) \
210+ TORCH_IMPL_FUNC (func##_out) (const Tensor& self, const Tensor& other, const Tensor& result) { \
211+ func##_stub (device_type (), *this ); \
212+ }
213+
214+ CREATE_BINARY_TORCH_IMPL_FUNC (gcd);
215+
201216Tensor special_xlog1py (const Scalar& x, const Tensor& y) {
202217 return at::special_xlog1py (wrapped_scalar_tensor (x), y);
203218}
@@ -1062,21 +1077,6 @@ Tensor logaddexp2(const Tensor& self, const Tensor& other) {
10621077 return at::logaddexp2_out (result, self, other);
10631078}
10641079
1065- Tensor& gcd_out (const Tensor& self, const Tensor& other, Tensor& result) {
1066- auto iter = TensorIterator::binary_op (result, self, other);
1067- gcd_stub (iter.device_type (), iter);
1068- return result;
1069- }
1070-
1071- Tensor gcd (const Tensor& self, const Tensor& other) {
1072- Tensor result = at::empty ({0 }, self.options ());
1073- return at::gcd_out (result, self, other);
1074- }
1075-
1076- Tensor& gcd_ (Tensor& self, const Tensor& other) {
1077- return at::gcd_out (self, self, other);
1078- }
1079-
10801080Tensor& lcm_out (const Tensor& self, const Tensor& other, Tensor& result) {
10811081 auto iter = TensorIterator::binary_op (result, self, other);
10821082 lcm_stub (iter.device_type (), iter);
0 commit comments