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
Can Scatter Be Reproducible? #226
Comments
Scatter is a non-deterministic operation by design since it makes use of atomic operations in which the order of aggregation is non-deterministic, leading to minor numerical differences. As an alternative, you can make use of the |
Thanks very much. But how can I get the same result by using the |
index = torch.tensor([0, 0, 0, 1, 2, 2])
ptr = torch.tensor([0, 3, 4, 6])
scatter(x, index, dim=0) == segment_csr(x, ptr) |
Thank you very much! |
By the way, if I cannot guarantee the indices are in order. And sorting is too time-consuming. How can I do or is there any other method that can achieve the same result as `scatter'? |
If you cannot guarantee that indices are in order, there exists no parallelized operation that can group elements while still being deterministic. This is just the natural imprecision of floating point arithmetic. |
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? |
I used scatter function to implement GCN like this:
re = scatter(embed, index, dim=0, out=None, dim_size=embed.size, reduce='mean')
I found that even though the input (embed and index) are the same when I run the code twice, the output are still different. So I want to know if the scatter method has any random seed, which lead to the result cannot be reproduced? How can I make the result of scatter deterministic? Thank you very much.
The text was updated successfully, but these errors were encountered: