Skip to content

Commit

Permalink
Add logical_or pytorch frontend (#13590)
Browse files Browse the repository at this point in the history
Co-authored-by: ZoeCD <[email protected]>
  • Loading branch information
AniTho and ZoeCD authored Apr 5, 2023
1 parent b126593 commit cbeb3d5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ivy/functional/frontends/torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ def abs_(self):
def logical_and(self, other):
return torch_frontend.logical_and(self._ivy_array, other)

def logical_or(self, other):
return torch_frontend.logical_or(self._ivy_array, other)

def bitwise_not(self, *, out=None):
return torch_frontend.bitwise_not(self._ivy_array)

Expand Down
36 changes: 36 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 @@ -3067,6 +3067,42 @@ def test_torch_instance_logical_and(
)


# logical_or
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="torch.tensor",
method_name="logical_or",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("bool", "integer"),
num_arrays=2,
),
)
def test_torch_instance_logical_or(
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,
)


# bitwise_not
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down

0 comments on commit cbeb3d5

Please sign in to comment.