diff --git a/ivy/functional/frontends/paddle/tensor/math.py b/ivy/functional/frontends/paddle/tensor/math.py index 2c6c5dd90ed2f..eb235a94538b6 100644 --- a/ivy/functional/frontends/paddle/tensor/math.py +++ b/ivy/functional/frontends/paddle/tensor/math.py @@ -108,6 +108,12 @@ def round(x, name=None): return ivy.round(x) +@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle") +@to_ivy_arrays_and_back +def round_(x, name=None): + return ivy.inplace_update(x, round(x)) + + @with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle") @to_ivy_arrays_and_back def ceil(x, name=None): @@ -400,6 +406,11 @@ def rsqrt(x, name=None): return 1 / ivy.sqrt(x) +@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") +def rsqrt_(x, name=None): + return ivy.inplace_update(x, ivy.reciprocal(ivy.inplace_update(x, ivy.sqrt(x)))) + + @with_supported_dtypes( {"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle" ) 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 66ba8586be7c8..50b4e48de810d 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 @@ -492,6 +492,35 @@ def test_paddle_round( ) +# round_ +@handle_frontend_test( + fn_tree="paddle.tensor.math.round_", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("float"), + min_value=1, + ), +) +def test_paddle_round_( + *, + dtype_and_x, + frontend, + test_flags, + fn_tree, + backend_fw, + on_device, +): + 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, + x=x[0], + ) + + # ceil @handle_frontend_test( fn_tree="paddle.tensor.math.ceil", @@ -1748,6 +1777,34 @@ def test_paddle_rsqrt( ) +# rsqrt_ +@handle_frontend_test( + fn_tree="paddle.tensor.math.rsqrt_", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + ), +) +def test_paddle_rsqrt_( + *, + dtype_and_x, + frontend, + test_flags, + fn_tree, + on_device, + 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, + x=x[0], + ) + + # prod @handle_frontend_test( fn_tree="paddle.tensor.math.prod",