From ec5a2d1fa68c93ef5a4084945f076813ac8f96de Mon Sep 17 00:00:00 2001 From: Gadri Ebenezer Date: Sat, 18 Nov 2023 16:29:12 +0000 Subject: [PATCH] feat: Paddle Frontend: tensor __ge__ (#27311) Co-authored-by: NripeshN --- .../frontends/paddle/tensor/tensor.py | 16 ++++++++ .../test_paddle/test_tensor/test_tensor.py | 37 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/ivy/functional/frontends/paddle/tensor/tensor.py b/ivy/functional/frontends/paddle/tensor/tensor.py index ee880dda5fc7..b84072c2da54 100644 --- a/ivy/functional/frontends/paddle/tensor/tensor.py +++ b/ivy/functional/frontends/paddle/tensor/tensor.py @@ -68,6 +68,22 @@ def ivy_array(self, array): def __add__(self, y, /, name=None): return paddle_frontend.add(self, y) + @with_unsupported_dtypes( + { + "2.5.2 and below": ( + "bool", + "uint8", + "int8", + "int16", + "complex64", + "complex128", + ) + }, + "paddle", + ) + def __ge__(self, y, /, name=None): + return paddle_frontend.logic.greater_equal(self, y) + @with_unsupported_dtypes( { "2.5.2 and below": ( diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py index a61d2e9ae759..d087dabccfb9 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py @@ -307,6 +307,43 @@ def test_paddle___add__( ) +# __ge__ +@handle_frontend_method( + class_tree=CLASS_TREE, + init_tree="paddle.to_tensor", + method_name="__ge__", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("numeric"), num_arrays=2, shared_dtype=True + ), +) +def test_paddle___ge__( + dtype_and_x, + frontend_method_data, + init_flags, + method_flags, + frontend, + on_device, + backend_fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_method( + init_input_dtypes=input_dtype, + backend_to_test=backend_fw, + init_all_as_kwargs_np={ + "data": x[0], + }, + method_input_dtypes=input_dtype, + method_all_as_kwargs_np={ + "y": x[1], + }, + frontend_method_data=frontend_method_data, + init_flags=init_flags, + method_flags=method_flags, + frontend=frontend, + on_device=on_device, + ) + + # __le__ @handle_frontend_method( class_tree=CLASS_TREE,