Alterlab torch geometric

From NVlabs/Skill2Env · View interactive version

Alterlab torch geometric is an AI agent skill from the GitHub repository NVlabs/Skill2Env. Graph Neural Networks with PyTorch Geometric (PyG) — node and graph classification, link prediction, GCN, GAT, and GraphSAGE layers, heterogeneous graphs, and molecular property prediction. Use when building or training GNNs for geometric deep learning on graph-structured data. Part of the AlterLab

How to use this skill

Skill file

PyTorch Geometric (PyG)

Overview

PyTorch Geometric is a library built on PyTorch for developing and training Graph Neural Networks (GNNs). Apply this skill for deep learning on graphs and irregular structures, including mini-batch processing, multi-GPU training, and geometric deep learning applications.

When to Use This Skill

This skill should be used when working with:

Quick Start

uv pip install torch_geometric

Graphs are torch_geometric.data.Data objects: x (node features [N, F]), edge_index

(connectivity in COO [2, E]), optional edge_attr, y, pos, and any custom attribute

(train_mask, etc.). DataLoader batches multiple graphs into one block-diagonal graph

(no padding); a batch vector maps nodes back to their source graph.

Full install/sparse-deps, basic graph creation, benchmark loading, edge-index format, and

mini-batching details: references/getting_started.md.

Core Workflow

  1. Load or build data — benchmark datasets, custom InMemoryDataset, or from CSV

(references/datasets_and_loading.md; full catalog in references/datasets_reference.md).

  1. Define a GNN — stack pre-built conv layers (GCNConv, GATConv, SAGEConv) or subclass

MessagePassing for custom layers (references/building_gnns.md; full layer list in

references/layers_reference.md).

  1. Train — node classification (single graph, train/test masks), graph classification

(DataLoader + global pooling), or large-scale via NeighborLoader neighbor sampling

(references/training_workflows.md).

  1. Go advanced if needed — HeteroData/to_hetero for heterogeneous graphs, transforms,

GNNExplainer explainability, hierarchical pooling, GPU, save/load

(references/advanced_features.md; transforms catalog in references/transforms_reference.md).

Building GNNs (at a glance)

GNNs follow neighborhood aggregation: transform node features → propagate messages along edges →

aggregate from neighbors → update representations. PyG ships 40+ conv layers. When choosing one,

check its capabilities: SparseTensor support, edge_weight, edge_attr, bipartite, and lazy

(-1 channel) initialization. Code for GCN/GAT/GraphSAGE and custom MessagePassing layers

(including the _i/_j target/source naming convention) is in references/building_gnns.md.

Resources

Bundled References

This skill includes detailed reference documentation:

Scripts

Utility scripts are provided in scripts/:

Execute scripts directly or read them for implementation patterns.

Official Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.