diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py index c0851629b924..c2a42104177c 100644 --- a/ivy/functional/frontends/torch/tensor.py +++ b/ivy/functional/frontends/torch/tensor.py @@ -543,9 +543,17 @@ def erf_(self, *, out=None): {"2.2 and below": {"cpu": ("float32", "float64")}}, "torch", ) - def erfc_(self, *, out=None): + def erfc(self, *, out=None): return torch_frontend.erfc(self, out=out) + @with_supported_device_and_dtypes( + {"2.2 and below": {"cpu": ("float32", "float64")}}, + "torch", + ) + def erfc_(self, *, out=None): + self.ivy_array = self.erfc(out=out).ivy_array + return self + def new_zeros( self, *args, diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py index 07fda9a293a3..78c74dc992a5 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py @@ -6536,6 +6536,43 @@ def test_torch_erfinv_( ) +# erfc +@handle_frontend_method( + class_tree=CLASS_TREE, + init_tree="torch.tensor", + method_name="erfc", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("float"), + ), +) +def test_torch_tensor_erfc( + dtype_and_x, + frontend_method_data, + init_flags, + method_flags, + frontend, + on_device, + backend_fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_method( + init_input_dtypes=input_dtype, + backend_to_test=backend_fw, + init_all_as_kwargs_np={ + "data": x[0], + }, + method_input_dtypes=input_dtype, + method_all_as_kwargs_np={}, + frontend_method_data=frontend_method_data, + init_flags=init_flags, + method_flags=method_flags, + frontend=frontend, + on_device=on_device, + rtol_=1e-2, + atol_=1e-2, + ) + + # exp @handle_frontend_method( class_tree=CLASS_TREE,