TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-15

tensorplay.functional.logical_and

tensorplay.functional.logical_and(input, other, *, out=None) → Tensor[source]

Computes the element-wise logical AND of the given input tensors. Zeros are treated as False and nonzeros are treated as True.

Parameters:
  • input (Tensor) – the input tensor.

  • other (Tensor) – the tensor to compute AND with

Keyword Arguments:

out (Tensor, optional) – the output tensor.

Example:

>>> tensorplay.logical_and(tensorplay.tensor([True, False, True]), tensorplay.tensor([True, False, False]))
tensor([ True, False, False])
>>> a = tensorplay.tensor([0, 1, 10, 0], dtype=tensorplay.int8)
>>> b = tensorplay.tensor([4, 0, 1, 0], dtype=tensorplay.int8)
>>> tensorplay.logical_and(a, b)
tensor([False, False,  True, False])
>>> tensorplay.logical_and(a.double(), b.double())
tensor([False, False,  True, False])
>>> tensorplay.logical_and(a.double(), b)
tensor([False, False,  True, False])
>>> tensorplay.logical_and(a, b, out=tensorplay.empty(4, dtype=tensorplay.bool))
tensor([False, False,  True, False])

On this page

Ask DeepWiki