PyTorch torch.bitwise_and function
PyTorch torch reference manual
torch.bitwise_and is a function in PyTorch used for element-wise bitwise AND.
Function definition
torch.bitwise_and(input, other, *, out=None)
Usage examples
Example
import
torch
Bitwise AND example
x
=
torch.
tensor
(
[
5
,
3
,
7
]
,
dtype
=
torch.
int8
)
y
=
torch.
tensor
(
[
1
,
3
,
4
]
,
dtype
=
torch.
int8
)
result
=
torch.
bitwise_and
(
x
,
y
)
(
result
)