Skip to content

Commit

Permalink
feat: simplify paddle _elementwise_helper by removing broadcasting
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmoudAshraf97 committed Oct 28, 2023
1 parent d919d79 commit ea0eaad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ivy/functional/backends/paddle/elementwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
def _elementwise_helper(x1, x2):
if (not hasattr(x1, "dtype") or not hasattr(x2, "dtype")) or (x1.dtype != x2.dtype):
x1, x2 = ivy.promote_types_of_inputs(x1, x2)
if x1.shape != x2.shape:
x1, x2 = paddle_backend.broadcast_arrays(x1, x2)
# the following was needed in versions <=2.4.2 because most functions didn't
# accept 0D inputs along other inputs
# if x1.shape != x2.shape:
# x1, x2 = paddle_backend.broadcast_arrays(x1, x2)
return x1, x2, x1.dtype


Expand Down

0 comments on commit ea0eaad

Please sign in to comment.