Skip to content
Compare
Choose a tag to compare

A new minor version release, including further bugfixes, official PyTorch 1.10 support, as well as additional features and operators:

Features

Minor Changes

  • Data.to_homogeneous will now add node_type information to the homogeneous Data object
  • GINEConv now allows to transform edge features automatically in case their dimensionalities do not match (thanks to @CaypoH)
  • OGB_MAG will now add node_year information to paper nodes
  • Entities datasets do now allow the processing of HeteroData objects via the hetero=True option
  • Batch objects can now be batched together to form super batches
  • Added heterogeneous graph support for Center, Constant and LinearTransformation transformations
  • HeteroConv now allows to return "stacked" embeddings
  • The batch vector of a Batch object will now be initialized on the GPU in case other attributes are held in GPU memory

Bugfixes

  • Fixed the num_neighbors argument of NeighborLoader in order to specify an edge-type specific number of neighbors
  • Fixed the collate policy of lists of integers/strings to return nested lists
  • Fixed the Delaunay transformation in case the face attribute is not present in the data
  • Fixed the TGNMemory module to only read from the latest update (thanks to @cwh104504)
  • Fixed the pickle.PicklingError when Batch objects are used in a torch.multiprocessing.manager.Queue() (thanks to @RasmusOrsoe)
  • Fixed an issue with _parent state changing after pickling of Data objects (thanks to @zepx)
  • Fixed the ToUndirected transformation in case the number of edges and nodes are equal (thanks to @lmkmkrcc)
  • Fixed the from_networkx routine in case node-level and edge-level features share the same names
  • Removed the num_nodes warning when creating PairData objects
  • Fixed the initialization of the GeneralMultiLayer module in GraphGym (thanks to @fjulian)
  • Fixed custom model registration in GraphGym
  • Fixed a clash in the run_dir naming of GraphGym (thanks to @fjulian)
  • Includes a fix to prevent a GraphGym crash in case ROC-score is undefined (thanks to @fjulian)
  • Fixed the Batch.from_data_list routine on dataset slices (thanks to @dtortorella)
  • Fixed the MetaPath2Vec model in case there exists isolated nodes
  • Fixed torch_geometric.utils.coalesce with CUDA tensors
Compare
Choose a tag to compare

PyG 2.0.1

This is a minor release, bringing some emergency fixes to PyG 2.0.

Bugfixes

Compare
Choose a tag to compare

PyG 2.0 🎉 🎉 🎉

PyG (PyTorch Geometric) has been moved from my own personal account rusty1s to its own organization account pyg-team to emphasize the ongoing collaboration between TU Dortmund University, Stanford University and many great external contributors. With this, we are releasing PyG 2.0, a new major release that brings sophisticated heterogeneous graph support, GraphGym integration and many other exciting features to PyG.

If you encounter any bugs in this new release, please do not hesitate to create an issue.

Heterogeneous Graph Support

We finally provide full heterogeneous graph support in PyG 2.0. See here for the accompanying tutorial.

Highlights

  • Heterogeneous Graph Storage: Heterogeneous graphs can now be stored in their own dedicated data.HeteroData class (thanks to @yaoyaowd):

    from torch_geometric.data import HeteroData
    
    data = HeteroData()
    
    # Create two node types "paper" and "author" holding a single feature matrix:
    data['paper'].x = torch.randn(num_papers, num_paper_features)
    data['author'].x = torch.randn(num_authors, num_authors_features)
    
    # Create an edge type ("paper", "written_by", "author") holding its graph connectivity:
    data['paper', 'written_by', 'author'].edge_index = ...  # [2, num_edges]

    data.HeteroData behaves similar to a regular homgeneous data.Data object:

    print(data['paper'].num_nodes)
    print(data['paper', 'written_by', 'author'].num_edges)
    data = data.to('cuda')
  • Heterogeneous Mini-Batch Loading: Heterogeneous graphs can be converted to mini-batches for many small and single giant graphs via the loader.DataLoader and loader.NeighborLoader loaders, respectively. These loaders can now handle both homogeneous and heterogeneous graphs:

    from torch_geometric.loader import DataLoader
    
    loader = DataLoader(heterogeneous_graph_dataset, batch_size=32, shuffle=True)
    
    from torch_geometric.loader import NeighborLoader
    
    loader = NeighborLoader(heterogeneous_graph, num_neighbors=[30, 30], batch_size=128,
                            input_nodes=('paper', data['paper'].train_mask), shuffle=True)
  • Heterogeneous Graph Neural Networks: Heterogeneous GNNs can now easily be created from homogeneous ones via nn.to_hetero and nn.to_hetero_with_bases. These processes take an existing GNN model and duplicate their message functions to account for different node and edge types:

    from torch_geometric.nn import SAGEConv, to_hetero
    
    class GNN(torch.nn.Module):
        def __init__(hidden_channels, out_channels):
            super().__init__()
            self.conv1 = SAGEConv((-1, -1), hidden_channels)
            self.conv2 = SAGEConv((-1, -1), out_channels)
    
        def forward(self, x, edge_index):
            x = self.conv1(x, edge_index).relu()
            x = self.conv2(x, edge_index)
            return x
    
    model = GNN(hidden_channels=64, out_channels=dataset.num_classes)
    model = to_hetero(model, data.metadata(), aggr='sum')

Additional Features

Managing Experiments with GraphGym

GraphGym is now officially supported in PyG 2.0 via torch_geometric.graphgym. See here for the accompanying tutorial. Overall, GraphGym is a platform for designing and evaluating Graph Neural Networks from configuration files via a highly modularized pipeline (thanks to @JiaxuanYou):

  1. GraphGym is the perfect place to start learning about standardized GNN implementation and evaluation
  2. GraphGym provides a simple interface to try out thousands of GNN architectures in parallel to find the best design for your specific task
  3. GraphGym lets you easily do hyper-parameter search and visualize what design choices are better

Breaking Changes

  • The datasets.AMiner dataset now returns a data.HeteroData object. See here for our updated MetaPath2Vec example on AMiner.
  • transforms.AddTrainValTestMask has been replaced in favour of transforms.RandomNodeSplit
  • Since the storage layout of data.Data significantly changed in order to support heterogenous graphs, already processed datasets need to be re-processed by deleting the root/processed folder.
  • data.Data.__cat_dim__ and data.Data.__inc__ now expect additional input arguments:
    def __cat_dim__(self, key, value, *args, **kwargs):
        pass
      
    def __inc__(self, key, value, *args, **kwargs):
        pass
    In case you modified __cat_dim__ or __inc__ functionality in a customized data.Data object, please ensure to apply the above changes.

Deprecations

Additional Features

Minor Changes

Bugfixes

Compare
Choose a tag to compare

Datasets

Bugfixes

Compare
Choose a tag to compare

A minor release that brings PyTorch 1.9.0 and Python 3.9 support to PyTorch Geometric. In case you are in the process of updating to PyTorch 1.9.0, please re-install the external dependencies for PyTorch 1.9.0 as well (torch-scatter and torch-sparse).

Features

Datasets

Issues

Compare
Choose a tag to compare

Major Features

Additional Features

Minor Changes

Datasets

Bugfixes

Compare
Choose a tag to compare
Compare
Choose a tag to compare

Features

Minor improvements

  • The SIGN example now operates on mini-batches of nodes
  • Improved data loading runtime of InMemoryDatasets
  • NeighborSampler does now work with SparseTensor as input
  • ToUndirected transform in order to convert directed graphs to undirected ones
  • GNNExplainer does now allow for customizable edge and node feature loss reduction
  • aggr can now passed to any GNN based on the MessagePassing interface (thanks to @m30m)
  • Runtime improvements in SEAL (thanks to @muhanzhang)
  • Runtime improvements in torch_geometric.utils.softmax (thanks to @Book1996)
  • GAE.recon_loss now supports custom negative edge indices (thanks to @reshinthadithyan)
  • Faster spmm computation and random_walk sampling on CPU (torch-sparse and torch-cluster updates required)
  • DataParallel does now support the follow_batch argument
  • Parallel approximate PPR computation in the GDC transform (thanks to @klicperajo)
  • Improved documentation by providing an autosummary of all subpackages (thanks to @m30m)
  • Improved documentation on how edge weights are handled in various GNNs (thanks to @m30m)

Bugfixes

  • Fixed a bug in GATConv when computing attention coefficients in bipartite graphs
  • Fixed a bug in GraphSAINTSampler that led to wrong edge feature sampling
  • Fixed the DimeNet pretraining link
  • Fixed a bug in processing ego-twitter and ego-gplus of the SNAPDataset collection
  • Fixed a number of broken dataset URLs (ICEWS18, QM9, QM7b, MoleculeNet, Entities, PPI, Reddit, MNISTSuperpixels, ShapeNet)
  • Fixed a bug in which MessagePassing.jittable() tried to write to a file without permission (thanks to @twoertwein)
  • GCNConv does not require edge_weight in case normalize=False
  • Batch.num_graphs will now report the correct amount of graphs in case of zero-sized graphs
Compare
Choose a tag to compare

This is a minor release, mostly focusing on PyTorch 1.6.0 support. All external wheels are now also available for PyTorch 1.6.0.

New Features

Bugfixes

  • Fixed a bug which prevented GNNExplainer to work with GATConv
  • Fixed the MessagePassing.jittable call when installing PyG via pip
  • Fixed a bug in torch-sparse where reduce functions with dim=0 did not yield the correct result
  • Fixed a bug in torch-sparse which suppressed all warnings
Compare
Choose a tag to compare

A new major release, introducing TorchScript support, memory-efficient aggregations, bipartite GNN modules, static graphs and much more!

Major Features

  • TorchScript support, see here for the accompanying tutorial (thanks to @lgray and @liaopeiyuan)
  • Memory-efficient aggregations via torch_sparse.SparseTensor, see here for the accompanying tutorial
  • Most GNN modules can now operate on bipartite graphs (and some of them can also operate on different feature dimensionalities for source and target nodes), useful for neighbor sampling or heterogeneous graphs:
conv = SAGEConv(in_channels=(32, 64), out_channels=64)
out = conv((x_src, x_dst), edge_index)
  • Static graph support:
conv = GCNConv(in_channels=32, out_channels=64)

x = torch.randn(batch_size, num_nodes, in_channels)
out = conv(x, edge_index)
print(out.size())
>>> torch.Size([batch_size, num_nodes, out_channels])

Additional Features

Breaking Changes

Complementary Frameworks

  • DeepSNAP: A PyTorch library that bridges between graph libraries such as NetworkX and PyTorch Geometric
  • PyTorch Geometric Temporal: A temporal GNN library built upon PyTorch Geometric

Datasets

Bugfixes

  • Fixed a bug in the VGAE KL-loss computation (thanks to @GuillaumeSalha)