A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pytorch.org/docs/stable/generated/torch.logical_and.html below:

torch.logical_and — PyTorch 2.7 documentation

torch.logical_and
torch.logical_and(input, other, *, out=None) Tensor

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:

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4