Загрузка
Tests if any element in input evaluates to True.
input (Tensor) – the input tensor.
out (Tensor, optional) – the output tensor.
Example:
>>> a = torch.rand(1, 2).bool()
>>> a
tensor([[False, True]], dtype=torch.bool)
>>> torch.any(a)
tensor(True, dtype=torch.bool)
>>> a = torch.arange(0, 3)
>>> a
tensor([0, 1, 2])
>>>
For each row of input in the given dimension dim,
returns True if any element in the row evaluate to True and False otherwise.
If keepdim is True, the output tensor is of the same size
as input except in the dimension(s) dim where it is of size 1.
Otherwise, dim is squeezed (see torch.squeeze()), resulting in the
output tensor having 1 (or len(dim)) fewer dimension(s).
Example:
>>> a = torch.randn(4, 2) < 0
>>> a
tensor([[ True, True],
[False, True],
[ True, True],
[False, False]])
>>> torch.any(a, 1)
tensor([ True, True, True, False])
>>> torch.any(a
out (Tensor, optional) – the output tensor.