Pytorch_scatter vs Torch.scatter
L-Reichardt opened this issue · comments
Hello,
thank you very much for this library and for the active support. I have been using it continuously in the last two years and it has been indispensable for PointCloud processing.
I recently learned that scatter operations were introduced to PyTorch (because of the popularity of this package) and wanted to ask, if there are any major differences / planned support in the future. I.e. should I use on over the other for future projects?
Best Regards,
L
In general, I recommend to use the PyTorch ops due to ease of use and ease of installation. We worked hard to bring these ops to PyTorch directly. torch-scatter
has still the following advantages:
- It provides
segment_coo
andsegment_csr
reductions - It has faster code paths for
scatter_max
andscatter_min
(especially in the backward pass)
However, please note that torch-scatter
is slow on CPU, and it is preferred to use the PyTorch ops for CPU when you don't have a GPU available. That's why we also introduced torch_geometric.utils.scatter
that picks the best computation dependent on reduce
and device
, see https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/utils/scatter.py#L50.