Skip to content

Commit

Permalink
fix: handle complex type correctly in greater equal in paddle frontend (
Browse files Browse the repository at this point in the history
  • Loading branch information
ZJay07 authored Apr 2, 2024
1 parent 619cce9 commit b04c444
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ivy/functional/backends/paddle/elementwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +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 = paddle.greater_equal(x1.real(), x2.real())
imag = paddle.greater_equal(x1.imag(), x2.imag())
return paddle.logical_and(real, imag)
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)


Expand Down

0 comments on commit b04c444

Please sign in to comment.