Skip to content

scatter_logsumexp broken for untouched outputs #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Pierre-Bartet opened this issue May 24, 2024 · 2 comments · Fixed by #445
Closed

scatter_logsumexp broken for untouched outputs #444

Pierre-Bartet opened this issue May 24, 2024 · 2 comments · Fixed by #445

Comments

@Pierre-Bartet
Copy link

The following code incorrectly set an unused output element to 0 instead of letting it to its original value (here -10):

import torch
from torch_scatter import scatter_logsumexp

src = torch.tensor([-1., -50])
index = torch.tensor([0, 0])

out = torch.full((2,), -10.)

scatter_logsumexp(src=src, index=index, out=out)
# tensor([-0.9999,  0.0000]) instead of tensor([-0.9999,  -10])

which mean scatter_logsumexp only works in the corner case where all outputs are affected by the scatter operation.

@rusty1s
Copy link
Owner

rusty1s commented May 27, 2024

Thanks. Will be fixed in #445.

@Pierre-Bartet
Copy link
Author

Thanks for the quick fix (and the whole library)!
Looking at the code I see that there is a return out.nan_to_num_(neginf=0.0), but - inf is a perfectly legit output value.
Is there something preventing the correct handling of these cases #426 and #407 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants