How to check if all values of a torch.tensor is False using torch.all or another utility?

is there an equivalent of torch.all torch.all — PyTorch 1.8.1 documentation but for checking to see if all of values of a torch.tensor is false?

>>> a
tensor([[ True,  True],
        [ True, False],
        [ True,  True],
        [ True,  True]])
>>> torch.all(a)

Here, torch.all checks to see if all values are True or not.

>>> b = torch.tensor([[False, False], [False, False], [False, False]])
>>> b
tensor([[False, False],
        [False, False],
        [False, False]])
>>> torch.all(b == False)
1 Like
not torch.any(a)

also does the trick