From 93e442f2deb9ae8e457681d4670b63d3285c86d4 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:33:52 +0000 Subject: [PATCH 1/2] fixed less_equal --- ivy/functional/backends/paddle/elementwise.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ivy/functional/backends/paddle/elementwise.py b/ivy/functional/backends/paddle/elementwise.py index 92d812e15450..48fa2a480c57 100644 --- a/ivy/functional/backends/paddle/elementwise.py +++ b/ivy/functional/backends/paddle/elementwise.py @@ -136,8 +136,8 @@ def equal( return paddle.equal(x1, x2) -@with_unsupported_dtypes( - {"2.6.0 and below": ("bool",)}, +@with_supported_dtypes( + {"2.6.0 and below": ("bool", "float32", "float64", "int32", "int64")}, backend_version, ) def less_equal( From 25f4492c7895f8f522ce05e928b93ec17221a988 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:32:04 +0000 Subject: [PATCH 2/2] fixed less_equal --- ivy/functional/backends/paddle/elementwise.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ivy/functional/backends/paddle/elementwise.py b/ivy/functional/backends/paddle/elementwise.py index 48fa2a480c57..0498cd1f283d 100644 --- a/ivy/functional/backends/paddle/elementwise.py +++ b/ivy/functional/backends/paddle/elementwise.py @@ -137,7 +137,7 @@ def equal( @with_supported_dtypes( - {"2.6.0 and below": ("bool", "float32", "float64", "int32", "int64")}, + {"2.6.0 and below": ("bool", "float32", "float64", "int32", "int64", "complex")}, backend_version, ) def less_equal( @@ -147,14 +147,17 @@ def less_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_comparison = paddle.real(x1) < paddle.real(x2) - imag_comparison = paddle_backend.logical_and( - paddle.real(x1) == paddle.real(x2), paddle.imag(x1) < paddle.imag(x2) + real_less_equal = paddle.real(x1) <= paddle.real(x2) + real_equal = paddle.real(x1) == paddle.real(x2) + + imag_less_equal = paddle.imag(x1) <= paddle.imag(x2) + + return paddle.logical_or( + real_less_equal, paddle.logical_and(real_equal, imag_less_equal) ) - return paddle_backend.logical_or(real_comparison, imag_comparison) return paddle.less_equal(x1, x2)