Add docs and test guaranteeing indices from torch.nonzero ordered C-style (#19539)

Summary:
See #17556.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19539

Differential Revision: D15030151

Pulled By: ezyang

fbshipit-source-id: d46ee56a66d89b0113f86e3f8693dc1680d0adb9
This commit is contained in:
jhultman
2019-04-23 09:23:06 -07:00
committed by Facebook Github Bot
parent 3b4d4ef503
commit f767c9ac76
2 changed files with 56 additions and 31 deletions

View File

@ -3459,7 +3459,8 @@ nonzero(input, out=None) -> LongTensor
Returns a tensor containing the indices of all non-zero elements of
:attr:`input`. Each row in the result contains the indices of a non-zero
element in :attr:`input`.
element in :attr:`input`. The result is sorted lexicographically, with
the last index changing the fastest (C-style).
If :attr:`input` has `n` dimensions, then the resulting indices tensor
:attr:`out` is of size :math:`(z \times n)`, where :math:`z` is the total number of