From 683c54a3a81d7d9b35de4d849aa00ad1eb310d31 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:59:12 +0000 Subject: [PATCH 1/2] fixed paddle.greater_equal --- ivy/functional/backends/paddle/elementwise.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ivy/functional/backends/paddle/elementwise.py b/ivy/functional/backends/paddle/elementwise.py index b6233c15de579..2b4ecba5f4775 100644 --- a/ivy/functional/backends/paddle/elementwise.py +++ b/ivy/functional/backends/paddle/elementwise.py @@ -470,7 +470,6 @@ def greater( "int16", "int32", "int64", - "complex", ) }, backend_version, @@ -483,11 +482,6 @@ def greater_equal( out: Optional[paddle.Tensor] = None, ) -> paddle.Tensor: x1, x2, ret_dtype = _elementwise_helper(x1, x2) - if isinstance(x1, paddle.Tensor) and isinstance(x2, paddle.Tensor): - if paddle.is_complex(x1) and paddle.is_complex(x2): - real = paddle.greater_equal(x1.real(), x2.real()) - imag = paddle.greater_equal(x1.imag(), x2.imag()) - return paddle.logical_and(real, imag) return paddle.greater_equal(x1, x2) From f70e78d1e41c39cb2e4464620a17e319c9deb371 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:41:38 +0000 Subject: [PATCH 2/2] proper fix --- ivy/functional/backends/paddle/elementwise.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ivy/functional/backends/paddle/elementwise.py b/ivy/functional/backends/paddle/elementwise.py index 2b4ecba5f4775..76b60740ca9e7 100644 --- a/ivy/functional/backends/paddle/elementwise.py +++ b/ivy/functional/backends/paddle/elementwise.py @@ -470,6 +470,7 @@ def greater( "int16", "int32", "int64", + "complex", ) }, backend_version, @@ -481,7 +482,16 @@ def greater_equal( *, out: Optional[paddle.Tensor] = None, ) -> paddle.Tensor: - x1, x2, ret_dtype = _elementwise_helper(x1, x2) + x1, x2, _ = _elementwise_helper(x1, x2) + if isinstance(x1, paddle.Tensor) and isinstance(x2, paddle.Tensor): + if paddle.is_complex(x1) and paddle.is_complex(x2): + real_greater_equal = paddle.real(x1) >= paddle.real(x2) + real_equal = paddle.real(x1) == paddle.real(x2) + imag_greater_equal = paddle.imag(x1) >= paddle.imag(x2) + return paddle.logical_or( + real_greater_equal, paddle.logical_and(real_equal, imag_greater_equal) + ) + return paddle.greater_equal(x1, x2)