pyg-team/pytorch_geometric

Support for other integer types by MessagePassing

Open

#5,087 opened on Jul 29, 2022

View on GitHub
 (10 comments) (0 reactions) (0 assignees)Python (3,514 forks)batch import
1 - Priority P1featurehelp wanted

Repository metrics

Stars
 (19,985 stars)
PR merge metrics
 (Avg merge 35d 1h) (14 merged PRs in 30d)

Description

🐛 Describe the bug

Why does PyG enforces edge_index to be of type long? Certain graphs can work properly with int16 such as molecules, which will rarely surpass the 32767, unless batch sizes larger than 1000 are used. They have an average of 20 atoms. Instead, we could simply ensure that there are no negative numbers (which happen when the edge index overflows), or that the maximum of a specific datatype is not reached.

Also, some hardwares do not support long, such as TPU and IPU, which are limited to int32.

https://github.com/pyg-team/pytorch_geometric/blob/412ae53d0897660a2968283ed2cc60b5928c1229/torch_geometric/nn/conv/message_passing.py#L183

Environment

  • PyG version: All
  • PyTorch version: All
  • OS: All
  • Python version: All
  • CUDA/cuDNN version: All
  • How you installed PyTorch and PyG (conda, pip, source): Any
  • Any other relevant information (e.g., version of torch-scatter): Any

Contributor guide