Skip to content

indexing with numpy elements #165

@glample

Description

@glample

Currently, "the only supported types to index a tensor are integers, slices and torch.ByteTensor". Would it be possible to add numpy arrays as well, especially in the case where they contain only one element? For instance, this code will raise an error:

a = torch.FloatTensor(3).normal_()
i = np.int32([2, 0, 1])
a[i[0]]

And requires to do a[int(i[0])] instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    todoNot as important as medium or high priority tasks, but we will work on these.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions