Return the nonzero positions
(self)
| 273 | return Index(tensor, self.dtype) |
| 274 | |
| 275 | def nonzero(self): |
| 276 | """Return the nonzero positions""" |
| 277 | tensor = self.tousertensor() |
| 278 | mask = F.nonzero_1d(tensor != 0) |
| 279 | return Index(mask, self.dtype) |
| 280 | |
| 281 | def has_nonzero(self): |
| 282 | """Check if there is any nonzero value in this Index""" |