From f6ceabd0f5fc02534bb0b189091b712d3135cfee Mon Sep 17 00:00:00 2001 From: Aaryan562 Date: Thu, 14 Sep 2023 09:42:22 +0000 Subject: [PATCH] Added floor_ method in paddle frontend --- .../frontends/paddle/tensor/math.py | 6 ++++ .../test_paddle/test_tensor/test_math.py | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/ivy/functional/frontends/paddle/tensor/math.py b/ivy/functional/frontends/paddle/tensor/math.py index c581e3b0796ee..3de3b3e1fbf16 100644 --- a/ivy/functional/frontends/paddle/tensor/math.py +++ b/ivy/functional/frontends/paddle/tensor/math.py @@ -21,6 +21,12 @@ def exp_(x, name=None): return ivy.inplace_update(x, exp(x)) +@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") +@to_ivy_arrays_and_back +def floor_(x, name=None): + return ivy.inplace_update(x, floor(x)) + + @with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") @to_ivy_arrays_and_back def lerp_(x, y, weight, name=None): 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..486c5c36315ec 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 @@ -59,6 +59,34 @@ def test_paddle_exp_( ) +# floor_ +@handle_frontend_test( + fn_tree="paddle.tensor.math.floor_", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + ), +) +def test_paddle_floor_( + *, + dtype_and_x, + frontend, + backend_fw, + test_flags, + fn_tree, + on_device, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + frontend=frontend, + backend_to_test=backend_fw, + test_flags=test_flags, + fn_tree=fn_tree, + on_device=on_device, + x=x[0], + ) + + # lerp_ @handle_frontend_test( fn_tree="paddle.tensor.math.lerp_",