torch.is_nonzero
- torch.is_nonzero(input)
Returns True if the
inputis a single element tensor which is not equal to zero after type conversions. i.e. not equal totorch.tensor([0.])ortorch.tensor([0])ortorch.tensor([False]). Throws aif (even in case of sparse tensors).