PyTorch Geometric (PyG) is a library built upon PyTorch to easily write and train Graph Neural Networks (GNNs) for a wide range of applications related to structured data. It consists of various methods for deep learning on graphs and other irregular structures, providing easy-to-use mini-batch loaders, multi-GPU support, `torch.compile` support, a large number of common benchmark datasets, and helpful transforms. It is actively maintained with frequent minor releases delivering new features and bug fixes.
pip install torch_geometricVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a basic graph using PyTorch Geometric's `Data` object, which is the fundamental building block for representing graphs. It defines node features and graph connectivity (edges) and then prints basic properties of the created graph.
Upgrade Python to 3.10 or newer, and PyTorch to 2.6 or newer. Check the official PyG installation guide for specific PyTorch/CUDA compatibility tables.
Always refer to the official PyTorch Geometric installation instructions. Use the provided `-f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html` link, replacing `${TORCH}` and `${CUDA}` placeholders with your exact PyTorch and CUDA versions.Replace usages of `torch_geometric.compile(model)` with `torch.compile(model)`. Remove `jittable=True` from `MessagePassing` layer initializations if present.
Review the updated documentation for `GraphMultisetTransformer` and adjust your model's implementation accordingly.