You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arguably, indexing a Tensor by a LongTensor with no dimension should return a LongTensor with no dimension. Consider the following case:
>>> a = torch.ones(5)
>>> a[a<0]
[torch.FloatTensor with no dimension]
>>> a[(a<0).nonzero().squeeze()]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: invalid argument 3: Index is supposed to be a vector at /opt/conda/conda-bld/pytorch_1503966894950/work/torch/lib/TH/generic/THTensorMath.c:248
This breaks indexing by indices when the list of indices is empty, which can be hard to detect. In my use-case, I use such a masking to select rows of a tensor corresponding to "valid" entries in a vector; I had not considered that it would not work when there are no valid entries.
The text was updated successfully, but these errors were encountered:
Arguably, indexing a Tensor by a LongTensor with no dimension should return a LongTensor with no dimension. Consider the following case:
This breaks indexing by indices when the list of indices is empty, which can be hard to detect. In my use-case, I use such a masking to select rows of a tensor corresponding to "valid" entries in a vector; I had not considered that it would not work when there are no valid entries.
The text was updated successfully, but these errors were encountered: