torch.Tensor.bool Tensor.bool(memory_format=torch.preserve_format) → Tensor self.bool() is equivalent to self.to(torch.bool). See .