diff --git a/ivy/functional/frontends/paddle/tensor/math.py b/ivy/functional/frontends/paddle/tensor/math.py index c581e3b0796ee..a2b3f4e4989f4 100644 --- a/ivy/functional/frontends/paddle/tensor/math.py +++ b/ivy/functional/frontends/paddle/tensor/math.py @@ -49,8 +49,12 @@ def rsqrt_(x, name=None): def sqrt_(x, name=None): return ivy.inplace_update(x, sqrt(x)) - @with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") @to_ivy_arrays_and_back def subtract_(x, y, name=None): return ivy.inplace_update(x, subtract(x, y)) + +@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") +@to_ivy_arrays_and_back +def tanh_(x, name=None): + return ivy.inplace_update(x, tanh(x)) diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py index 68f956a7c7eb5..0435111ba638f 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py @@ -179,7 +179,6 @@ def test_paddle_rsqrt_( x=x[0], ) - # sqrt_ @handle_frontend_test( fn_tree="paddle.tensor.math.sqrt_", @@ -206,8 +205,6 @@ def test_paddle_sqrt_( on_device=on_device, x=x[0], ) - - # subtract_ @handle_frontend_test( fn_tree="paddle.tensor.math.subtract_", @@ -241,3 +238,31 @@ def test_paddle_subtract_( x=x[0], y=x[1], ) + +#tanh_ +@handle_frontend_test( + fn_tree="paddle.tensor.math.tanh_", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + ), +) +def test_paddle_tanh_( + *, + dtype_and_x, + on_device, + fn_tree, + frontend, + test_flags, + backend_fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + backend_to_test=backend_fw, + frontend=frontend, + test_flags=test_flags, + fn_tree=fn_tree, + on_device=on_device, + atol=1e-2, + x=x[0], + )