Skip to content

Commit

Permalink
bitwise_or (ivy-llc#9861)
Browse files Browse the repository at this point in the history
* bitwise_or

Close ivy-llc#9848

* bitwise_or

Close ivy-llc#9848

* Update test_tensor.py

* Update test_tensor.py

* Update tensor.py

* Update tensor.py
  • Loading branch information
ahmedqazi123 authored Jan 21, 2023
1 parent fbdd3ed commit c9a14db
Show file tree
Hide file tree
Showing 2 changed files with 43 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 @@ -256,6 +256,9 @@ def abs_(self):
def bitwise_and(self, other):
return torch_frontend.bitwise_and(self._ivy_array, other)

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

def contiguous(self, memory_format=None):
return torch_frontend.tensor(self.ivy_array)

Expand Down
40 changes: 40 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 @@ -2778,6 +2778,46 @@ def test_torch_instance_bitwise_and(
)


# bitwise_or
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="torch.tensor",
method_name="bitwise_or",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("integer"),
num_arrays=2,
),
)
def test_torch_instance_bitwise_or(
dtype_and_x,
init_num_positional_args: pf.NumPositionalArgFn,
method_num_positional_args: pf.NumPositionalArgMethod,
as_variable: pf.AsVariableFlags,
native_array: pf.NativeArrayFlags,
frontend_method_data,
frontend,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_as_variable_flags=as_variable,
init_num_positional_args=init_num_positional_args,
init_native_array_flags=native_array,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_as_variable_flags=as_variable,
method_num_positional_args=method_num_positional_args,
method_native_array_flags=native_array,
method_all_as_kwargs_np={
"other": x[1],
},
frontend_method_data=frontend_method_data,
frontend=frontend,
)


# add_
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down

0 comments on commit c9a14db

Please sign in to comment.