8000 Inconsistency between index_select and __get_item__ · Issue #83702 · pytorch/pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Inconsistency between index_select and __get_item__ #83702
Closed
@smorad

Description

@smorad

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: advanced indexingRelated to x[i] = y, index functionstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0