Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing bitwise_xor method to PyTorch Frondend #13008

Merged
merged 5 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ivy/functional/frontends/torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,3 +869,6 @@ def __and__(self, other):
# Method aliases
absolute, absolute_ = abs, abs_
ndimension = dim

def bitwise_xor(self, other, *, out=None):
return torch_frontend.bitwise_xor(self._ivy_array, other)
37 changes: 37 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5734,3 +5734,40 @@ def test_torch_special_and(
frontend=frontend,
on_device=on_device,
)

# bitwise_xor

hmahmood24 marked this conversation as resolved.
Show resolved Hide resolved

@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="torch.tensor",
method_name="bitwise_xor",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("integer"),
hmahmood24 marked this conversation as resolved.
Show resolved Hide resolved
num_arrays=2,
),
)
def test_torch_instance_bitwise_xor(
dtype_and_x,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={
"other": x[1],
},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)