oneflow.bitwise_and

oneflow.bitwise_and()

Computes the bitwise AND of input and other. The input tensor must be of integral or Boolean types. For bool tensors, it computes the logical AND.

The interface is consistent with PyTorch. The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.bitwise_and.html

Parameters
Returns

The output Tensor

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> x = flow.tensor([1, 2, 3])
>>> flow.bitwise_and(x, 2)
tensor([0, 2, 2], dtype=oneflow.int64)
>>> y = flow.tensor([5, 6, 7])
>>> flow.bitwise_and(x, y)
tensor([1, 2, 3], dtype=oneflow.int64)