Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for other integer types by MessagePassing

See original GitHub issue

🐛 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.


  • 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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

rusty1scommented, Jul 30, 2022

Oh, my bad. I just tested with torch.short and was convinced it is only working for torch.long. I guess we can then start looking into supporting both torch.long and

hatemhelalcommented, Aug 26, 2022

See #5281 for a proposal to relax the type assertion in the message passing interface. This patch effectively lets the execution backend decide which integer types to support when executing the aggregation step. That said, with the default CPU backend the error message changes to:

E           RuntimeError: scatter(): Expected dtype int64 for index
Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for torch_geometric.nn.conv.message_passing
Module): r"""Base class for creating message passing layers of the form ... raise ValueError( ('`MessagePassing.propagate` only supports integer tensors of ...
Read more >
pytorch_geometric/ at master - GitHub
('`MessagePassing.propagate` only supports integer tensors of '. 'shape `[2, num_messages]`, `torch_sparse.SparseTensor` or '. '`torch.sparse.
Read more >
Message Passing Fundamentals
2. Datatype - the type of data to be sent. In the simplest cases this is an elementary type such as float/REAL, int/INTEGER,...
Read more >
Reading 22: Queues and Message-Passing
We'll use blocking queues (an existing threadsafe type) to implement message passing between ... Here's a message passing module for squaring integers:
Read more >
Message Passing in Java - GeeksforGeeks
It is used when threads do not have shared memory and are unable to share monitors or semaphores or any other shared variables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found