-
Notifications
You must be signed in to change notification settings - Fork 27.7k
scatter_ supporting different reduction modes #22378
Copy link
Copy link
Closed
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixhigh prioritymodule: internalsRelated to internal abstractions in c10 and ATenRelated to internal abstractions in c10 and ATenmodule: scatter & gather opsmodule: sparseRelated to torch.sparseRelated to torch.sparsetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixhigh prioritymodule: internalsRelated to internal abstractions in c10 and ATenRelated to internal abstractions in c10 and ATenmodule: scatter & gather opsmodule: sparseRelated to torch.sparseRelated to torch.sparsetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
🚀 Feature
Currently, we have
scatter_andscatter_add_.However, in use-cases such as Graph Neural Networks, it's common to wanting to do other reductions than add.
As a case in point, @rusty1s has written https://github.com/rusty1s/pytorch_scatter which has
add,sub,mean,max,min,std,mul,div.The kernels are there, and they are minor variations of the existing scatter kernel, see here.
We should provide this in PyTorch natively, ideally has a
reduce='add'keyword argument inscatter_, or if one wants it to be more explicit,scatter_reduce_(..., mode='mean')Motivation
Graph Neural Nets are becoming pretty common.
cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @anjali411 @bhosmer @smessmer @ljk53 @ailzhang @nikitaved @pearu @cpuhrsch @IvanYashchuk