From c9f74180151952d49e763927488ecce3698cf80a Mon Sep 17 00:00:00 2001 From: Rohan Dawkhar <86348193+sachelsout@users.noreply.github.com> Date: Thu, 20 Jul 2023 22:17:40 +0530 Subject: [PATCH] added atanh tensor instance method and test to PaddlePaddle frontend (#16438) Co-authored-by: zhumakhan --- .../frontends/paddle/tensor/tensor.py | 10 ++++-- .../test_paddle/test_tensor/test_tensor.py | 33 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ivy/functional/frontends/paddle/tensor/tensor.py b/ivy/functional/frontends/paddle/tensor/tensor.py index 44bdee5c4a77d..cea616a270c8c 100644 --- a/ivy/functional/frontends/paddle/tensor/tensor.py +++ b/ivy/functional/frontends/paddle/tensor/tensor.py @@ -1,7 +1,10 @@ # local import ivy import ivy.functional.frontends.paddle as paddle_frontend -from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes +from ivy.func_wrapper import ( + with_supported_dtypes, + with_unsupported_dtypes, +) from ivy.functional.frontends.paddle.func_wrapper import _to_ivy_array @@ -560,7 +563,6 @@ def logical_not(self, out=None, name=None): @with_unsupported_dtypes({"2.5.0 and below": ("float16", "bfloat16")}, "paddle") def sign(self, name=None): return ivy.sign(self._ivy_array) - return paddle_frontend.Tensor(ivy.sign(self._ivy_array, np_variant=False)) @with_unsupported_dtypes({"2.5.0 and below": ("float16", "bfloat16")}, "paddle") def sgn(self, name=None): @@ -576,6 +578,10 @@ def tolist(self): def min(self, axis=None, keepdim=False, name=None): return ivy.min(self._ivy_array, axis=axis, keepdims=keepdim) + @with_supported_dtypes({"2.5.0 and below": ("float32", "float64")}, "paddle") + def atanh(self, name=None): + return ivy.atanh(self._ivy_array) + @with_unsupported_dtypes({"2.4.2 and below": ("float32", "float64")}, "paddle") def std(self, axis=None, unbiased=True, keepdim=False, name=None): return paddle_frontend.Tensor( diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py index c7f1e93d6dfff..ad27980ac4763 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py @@ -2758,3 +2758,36 @@ def test_paddle_instance_std( frontend=frontend, on_device=on_device, ) + + +# atanh +@handle_frontend_method( + class_tree=CLASS_TREE, + init_tree="paddle.to_tensor", + method_name="atanh", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + ), +) +def test_paddle_atanh( + dtype_and_x, + frontend_method_data, + init_flags, + method_flags, + frontend, + on_device, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_method( + init_input_dtypes=input_dtype, + 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, + ) \ No newline at end of file