diff --git a/ivy/functional/frontends/paddle/math.py b/ivy/functional/frontends/paddle/math.py index 2496774347942..016309f169fe0 100644 --- a/ivy/functional/frontends/paddle/math.py +++ b/ivy/functional/frontends/paddle/math.py @@ -629,13 +629,8 @@ def square(x, name=None): @with_supported_dtypes({"2.6.0 and below": ("float32", "float64")}, "paddle") @to_ivy_arrays_and_back def stanh(x, scale_a=0.67, scale_b=1.7159, name=None): - # TODO this function will be simplified as soon as the ivy.stanh(x,a,b) is added - exp_ax = ivy.exp(ivy.multiply(scale_a, x)) - exp_minus_ax = ivy.exp(ivy.multiply(-scale_a, x)) - numerator = ivy.subtract(exp_ax, exp_minus_ax) - denominator = ivy.add(exp_ax, exp_minus_ax) - ret = ivy.multiply(scale_b, ivy.divide(numerator, denominator)) - return ret + ret = ivy.stanh(x, alpha=scale_b, beta=scale_a, out=name) + return ivy.asarray(ret, dtype=x.dtype) @with_unsupported_dtypes({"2.6.0 and below": ("float16", "bfloat16")}, "paddle") diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py index 0032efb319a90..b48b5408536a5 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py @@ -2495,8 +2495,20 @@ def test_paddle_square( dtype_and_x=helpers.dtype_and_values( available_dtypes=helpers.get_dtypes("float"), ), - scale_a=st.floats(1e-5, 1e5), - scale_b=st.floats(1e-5, 1e5), + scale_a=st.floats( + min_value=-5, + max_value=5, + allow_nan=False, + allow_subnormal=False, + allow_infinity=False, + ), + scale_b=st.floats( + min_value=-5, + max_value=5, + allow_nan=False, + allow_subnormal=False, + allow_infinity=False, + ), ) def test_paddle_stanh( *,