rusty1s / pytorch_scatter

PyTorch Extension Library of Optimized Scatter Operations

Home Page:https://pytorch-scatter.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`segment_csr` crashes Python when provided invalid `indptr`

ArchieGertsman opened this issue · comments

When I run the following code:

a = torch.arange(10)
indptr = torch.tensor([0]) # invalid ptr
segment_csr(a, indptr)

Python crashes on OSX with the following message:
image

I'm on version 2.0.9 of torch_scatter.
I think segment_csr should check for bad input like this.

Yes, the input needs to be

a = torch.arange(10)
indptr = torch.tensor([0, 10]) # invalid ptr
segment_csr(a, indptr)

In general, it is hard to check for invalid inputs in advance since this will lead to costly device transfers (e.g., querying indptr[0] and indptr[-1]).

This issue had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity. Is this issue already resolved?