Registry / ai-ml / torch-scatter

torch-scatter

JSON →
library2.1.2pypypiunverified

PyTorch Extension Library of Optimized Scatter Operations. Provides efficient scatter, gather, segment, and softmax operations for PyTorch tensors, commonly used in graph neural networks. Current version 2.1.2, released Oct 2023. Maintained by Rusty1s, part of the PyTorch Geometric ecosystem.

pip install torch-scatter
INSTALL
IMPORT
SIG · TORCH-SCATTER
T
torch-scatter
ai-mlpythonv2.1.2
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
build_error
glibc
py 3.10–3.910 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

scatter
✓ from torch_scatter import scatter
scatter_add
✓ from torch_scatter import scatter_add
scatter_max
✓ from torch_scatter import scatter_max
scatter_min
✓ from torch_scatter import scatter_min
scatter_mean
✓ from torch_scatter import scatter_mean
scatter_mul
✓ from torch_scatter import scatter_mul
scatter_softmax
✓ from torch_scatter import scatter_softmax
scatter_std
✓ from torch_scatter import scatter_std
segment_coo
✓ from torch_scatter import segment_coo
segment_csr
✓ from torch_scatter import segment_csr

Compute max over indices using scatter_max.

import torch from torch_scatter import scatter_max src = torch.tensor([1.0, 2.0, 3.0, 4.0, 5.0]) index = torch.tensor([0, 0, 1, 1, 1]) out, argmax = scatter_max(src, index, dim=0) print(out) # tensor([2., 5.])
Debug
Known issues
breakingVersion 2.1.0 removed `scatter_logsumexp` and changed `scatter_softmax` to no longer require an `eps` argument. Code using these must update calls.
fix
Use `torch_scatter.scatter_logsumexp` (new function) or remove `eps` from `scatter_softmax`.
affects: >=2.1.0
deprecated`scatter_` functions (e.g., `scatter_add_`) are deprecated in favor of the out-of-place versions. They may be removed in a future release.
fix
Replace `scatter_add_(src, index, out)` with `scatter_add(src, index, dim, out=out)`.
affects: >=2.0.0
gotchaWhen using CUDA, the installed wheel must match the PyTorch CUDA version exactly. Installing from PyPI may pull a CPU-only build if the CUDA version mismatch is detected.
fix
Install using the PyTorch Geometric wheel index: `pip install torch-scatter -f https://data.pyg.org/whl/torch-{torch_version}+{cu_version}.html`.
affects: all
gotcha`scatter_std` with `unbiased=False` uses Bessel's correction? Actually it uses population std. Check documentation: the flag defaults to `False` which computes the biased standard deviation.
fix
Set `unbiased=True` to compute sample standard deviation.
affects: >=2.0.0
Upgrade
Version history
2.1.2latest on PyPI · released Oct 6, 2023
Audit
Dependencies
torchrequiredCore dependency, torch-scatter compiles against specific PyTorch versions
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
torch-scatter — pip install torch-scatter · libregistry