diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py index 825ee0f2cab4e..f4c6252bda1f5 100644 --- a/ivy/functional/frontends/torch/tensor.py +++ b/ivy/functional/frontends/torch/tensor.py @@ -85,6 +85,9 @@ def abs_(self): self.data = self.abs() return self.data + def bitwise_and(self, other, *, out=None): + return torch_frontend.bitwise_and(self.data, other, out=out) + def contiguous(self, memory_format=None): return self.data diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py index f318b3b4eda34..9679c3a6d7c9e 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py @@ -1946,3 +1946,38 @@ def test_torch_instance_device(dtype_and_x, as_variable, native_array): class_name="tensor", method_name="device", ) + + +# bitwise_and +@handle_cmd_line_args +@given( + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("integer"), + num_arrays=2, + ) +) +def test_torch_instance_bitwise_and( + dtype_and_x, + as_variable, + native_array, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_method( + input_dtypes_init=input_dtype, + as_variable_flags_init=as_variable, + num_positional_args_init=1, + native_array_flags_init=native_array, + all_as_kwargs_np_init={ + "data": x[0], + }, + input_dtypes_method=input_dtype, + as_variable_flags_method=as_variable, + num_positional_args_method=1, + native_array_flags_method=native_array, + all_as_kwargs_np_method={ + "other": x[1], + }, + frontend="torch", + class_name="tensor", + method_name="bitwise_and" + )