Skip to content

Commit

Permalink
feat: Add bitwise XOR operation to Paddle Tensor class (#27344)
Browse files Browse the repository at this point in the history
Co-authored-by: niixxaaa <arunimasanthosh2302@gmail.comm>
Co-authored-by: NripeshN <nripesh14@gmail.com>
  • Loading branch information
3 people authored Nov 19, 2023
1 parent c0cb181 commit c1eabd0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def __iter__(self):
def __rmul__(self, y, /, name=None):
return paddle_frontend.multiply(self, y)

def __xor__(self, y, /, name=None):
return paddle_frontend.logic.bitwise_xor(self, y)

# Instance Methods #
# ---------------- #

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,45 @@ def test_paddle__rsub__(
)


# __xor__
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="__xor__",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("integer"),
num_arrays=2,
shared_dtype=True,
),
)
def test_paddle__xor__(
dtype_and_x,
frontend,
frontend_method_data,
init_flags,
method_flags,
backend_fw,
on_device,
):
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={
"value": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={
"y": x[1],
},
frontend=frontend,
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
on_device=on_device,
)


# abs
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down

0 comments on commit c1eabd0

Please sign in to comment.