torch.is_nonzero — PyTorch 1.10.1 documentation
pytorch.org › docs › stableLearn about PyTorch’s features and capabilities. Community. Join the PyTorch developer community to contribute, learn, and get your questions answered. Developer Resources. Find resources and get questions answered. Forums. A place to discuss PyTorch code, issues, install, research. Models (Beta) Discover, publish, and reuse pre-trained models
torch.count_nonzero — PyTorch 1.10.1 documentation
pytorch.org › docs › stabletorch.count_nonzero — PyTorch 1.10.0 documentation torch.count_nonzero torch.count_nonzero(input, dim=None) → Tensor Counts the number of non-zero values in the tensor input along the given dim . If no dim is specified then all non-zeros in the tensor are counted. Parameters input ( Tensor) – the input tensor.