Closed
Description
🐛 Describe the bug
We should be able to index using torch.int32
using the bracket notation. It is possible using index_select
:
>>> idx = torch.tensor([0]).int()
>>> a = torch.rand(3)
>>> a[idx]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: tensors used as indices must be long, byte or bool tensors
>>> a.index_select(0, idx)
tensor([0.6999])
When dealing with large sets of indices (e.g. graph edge lists), this means we have to use more memory.
Versions
master