Skip to content
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

Incorrect values compared to torch sum #450

Open
zuodexin opened this issue Jul 1, 2024 · 1 comment
Open

Incorrect values compared to torch sum #450

zuodexin opened this issue Jul 1, 2024 · 1 comment
Labels

Comments

@zuodexin
Copy link

zuodexin commented Jul 1, 2024

Hello. It seems that scatter_sum is not precise compared to torch implementation. Is this a bug? I encountered this problem in my personal project which is sensitive to numerical precision and it caused my program to produce incorrect results .

Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch_scatter
>>> import torch
>>> a = torch.randn(1,7,6)*100000
>>> ii = torch.zeros(7).long()
>>> ss = scatter_sum(a, ii, dim=1, dim_size=1)
>>> ss
tensor([[[-186314.9688, -331904.1875,  159179.0938,  189606.7188,   91803.9062,
            92107.0312]]])
>>> ss_target = a.sum(dim=1)
>>> ss_target
tensor([[-186314.9688, -331904.1875,  159179.0938,  189606.7188,   91803.9141,
           92107.0000]])
>>> ss==ss_target
tensor([[[ True,  True,  True,  True, False, False]]])

version
torch 1.10.0+cu113
torch-scatter 2.1.2

Copy link

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?

@github-actions github-actions bot added the stale label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant