Skip to content

Commit

Permalink
added atanh tensor instance method and test to PaddlePaddle frontend (#…
Browse files Browse the repository at this point in the history
…16438)

Co-authored-by: zhumakhan <zhumakhan.nazir@nu.edu.kz>
  • Loading branch information
sachelsout and zhumakhan authored Jul 20, 2023
1 parent abff08e commit c9f7418
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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):
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

0 comments on commit c9f7418

Please sign in to comment.