Questions tagged [pytorch-geometric]

Pytorch Geometric is a library for Graph Neural Networks (GNNs) and builds upon PyTorch. It contains various methods for writing and training GNNs on graphs from a variety of published papers. It supports mini-batch loaders for operation on GPUs.

Pytorch Geometric(PyG) is a library for Graph Neural Networks (GNNs) and builds upon PyTorch. It contains various methods for writing and training GNNs on graphs from a variety of published papers. It supports mini-batch loaders for operation on GPUs.

Features

  • Supports a variety of GNNs, see cheatsheet or the list of implemented GNN models many with small examples, such as Graph Attention Networks (GATs), Graph Convolutional Networks
  • Supports a variety of graphs: sparse graphs, graphs with edge weights, graphs with edge attributes, bipartite graphs, etc.
  • Contains the most well-known datasets, such as Cora or Zachary’s karate club, as well as being supported by many other such as the Open Graph Benchmark
  • Supports the GraphGym API to design and evaluate GNNs

Video and Colab Notebook Tutorial

240 questions
11
votes
4 answers

How to create a graph neural network dataset? (pytorch geometric)

How can I convert my own dataset to be usable by pytorch geometric for a graph neural network? All the tutorials use existing dataset already converted to be usable by pytorch. For example if I have my own pointcloud dataset how can i use it to…
10
votes
1 answer

How to load in graph from networkx into PyTorch geometric and set node features and labels?

Goal: I am trying to import a graph FROM networkx into PyTorch geometric and set labels and node features. (This is in Python) Question(s): How do I do this [the conversion from networkx to PyTorch geometric]? (presumably by using the from_networkx…
Rocky the Owl
  • 325
  • 1
  • 2
  • 11
10
votes
6 answers

PyTorch Geometric CUDA installation issues on Google Colab

I was working on a PyTorch Geometric project using Google Colab for CUDA support. Since it's library isn't present by default, I run: !pip install --upgrade torch-scatter !pip install --upgrade torch-sparse !pip install --upgrade torch-cluster !pip…
Kanishk Mair
  • 333
  • 1
  • 4
  • 8
6
votes
1 answer

How to visualize HeteroData pytorch geometric graph with any tool?

Hello what is a good way to visualize a pyg HeteroData object ? (defined similarly: https://pytorch-geometric.readthedocs.io/en/latest/notes/heterogeneous.html#creating-heterogeneous-gnns ) I tried with networkx but I think it is restricted to…
6
votes
1 answer

Positive and negative edges in train_test_split_edges from Pytorch geometric package

I am trying to find the explanation for negative and positive edges in a graph as explained in the opening of the function train_test_split_edges Pytorch Geometric doc. According to the doc file it says the function is supposed to split a graph into…
motiur
  • 1,640
  • 9
  • 33
  • 61
5
votes
1 answer

How to retain node ordering when converting graph from networkx to pytorch geometric?

Question: How to retain the node ordering/labels when converting a graph from networkx to pytorch geometric? Code: (to be run in Google Colab) import pandas as pd import numpy as np import matplotlib.pyplot as plt import networkx as nx import…
Rocky the Owl
  • 325
  • 1
  • 2
  • 11
5
votes
2 answers

What is the difference edge_weight and edge_attr in Pytorch Geometric

I want to handle weighted undirected graphs in Pytorch Geometric. The node features are 50 dimensional. I found that this can be handled by the x attribute of the torch_geometric.data.data class. The weights of the edges are scalar values. We found…
orangeman
  • 51
  • 1
  • 2
5
votes
2 answers

Pytorch Geometric sparse adjacency matrix to edge index tensor

My data object has the data.adj_t parameter, giving me the sparse adjacency matrix. How can I get the edge_index tensor of size [2, num_edges] from this?
Qubix
  • 4,161
  • 7
  • 36
  • 73
5
votes
1 answer

How to deal with the unlabeled nodes in Pytorch Geometric?

I have a dataset on my own, and the dataset contains two classes, let's say 0 and 1. Besides, there is a large part of nodes which class is unlabeled. My goal is to predict these unlabeled nodes using GCN. But I am confused about how to deal with…
4
votes
1 answer

Terminate called after throwing an instance of 'std::bad_alloc' from importing torch_geometric

I am writing in python and getting the error: "terminate called after throwing an instance of 'std::bad_alloc'. what(): std::bad_alloc. Aborted (core dumped)" After lots of debugging, I found out the source of the issue is: import…
4
votes
0 answers

Google Colab recent error: OSError: libcudart.so.10.2: cannot open shared object file: No such file or directory

I was successfully running the PyTorch Geometric Graph Classification popular example Google Colab notebook event last week: https://colab.research.google.com/drive/1I8a0DfQ3fI7Njc62__mVXUlcAleUclnb?usp=sharing But today (Mon 10/11/2021) running the…
3
votes
1 answer

Segmentation fault when importing torch-sparse (installing pytorch-geometric)

I am trying to install pytorch-geometric for a deep-learning project. Torch-sparse is throwing segmentation faults when I attempt to import it (see below). Initially I tried different versions of each required library, as I thought it might be a GPU…
3
votes
1 answer

Difference between pooling and global pooling in torch_geometric.nn

I realised that torch_geometric library offers both global pooling layers and pooling layers, but I don't really understand what is the difference between these 2 when applied to Graph Neural Networks?
tangolin
  • 434
  • 5
  • 15
3
votes
0 answers

Graph Autoencoder with PyTorch-Geometric

I'm creating a graph-based autoencoder for point-clouds. The original point-cloud's shape is [3, 1024] - 1024 points, each of which has 3 coordinates A point-cloud is turned into an undirected graph using the following steps: a point is turned into…
ann whoorma
  • 81
  • 1
  • 1
  • 8
3
votes
1 answer

PyTorch and torch_scatter were compiled with different CUDA versions on Google Colab despite attempting to specify same version

I'm installing pytorch geometric on Google colab. I've done this lots of times before and had no issues but it has suddenly stopped working. I've not changed my code since it worked. Here is how I install it: !pip install torch==1.8.1 torchvision…
Callum
  • 31
  • 1
  • 2
1
2 3
15 16