rusty1s / pytorch_scatter

PyTorch Extension Library of Optimized Scatter Operations

Home Page:https://pytorch-scatter.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pytorch_scatter vs Torch.scatter

L-Reichardt opened this issue · comments

commented

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 and segment_csr reductions
  • It has faster code paths for scatter_max and scatter_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.