Skip to content

Indexing rows and columns at the same time #214

Closed
@Chrixtar

Description

@Chrixtar

Hello everyone,

first up: I tried both torch.sparse as well as pytorch_sparse for my project and prefer the latter one any day.
So keep up the good work!

However, I noticed that indexing t[r, c] a tensor t with two LongTensor as rows r and columns c deviates from the indexing of PyTorch.
I expected to obtain the values at the coordinates specified by the two tensors at corresponding indices, i.e., a 1D torch.Tensor of the same length as the two index tensors.
Instead, the output corresponds to t[r][:, c] in case of a torch.Tensor.
Is there any fast way of indexing as described above (with autograd support)?

If it helps: In my case, I know for sure that all these coordinates are nonzero in the indexed tensor.

Thank you very much for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions