One-click install
npx skills add https://github.com/tamagusko/linux-cfg --skill torch-geometric-tamagusko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: torch-geometric
Source: https://github.com/tamagusko/linux-cfg/tree/main/dotfiles/claude/skills/torch-geometric
Command: npx skills add https://github.com/tamagusko/linux-cfg --skill torch-geometric-tamagusko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, torch_geometric, and includes references (resource) components.

What problem does it solve? Building Graph Neural Networks involves many error-prone details: correct edge_index formatting, choosing the right convolution layer, mini-batch sampling for large graphs, and handling heterogeneous node and edge types. This Skill provides working patterns and reference implementations for every stage of PyG development. ## Core Features & Use Cases - GNN Model Building: Ready-to-use patterns for GCN, GAT, GraphSAGE, GIN, and custom MessagePassing layers with the _i/_j indexing convention. - Task-Specific Training Loops: Complete code for node classification, graph classification with global pooling, and link prediction with negative sampling and GAE/VGAE autoencoders. - Scaling & Heterogeneous Graphs: NeighborLoader mini-batch training, DDP multi-GPU setup, to_hetero() conversion, HeteroConv, and HGTConv for multi-type graphs. - Use Case: You need to train a GraphSAGE model on a large citation network that does not fit in GPU memory. The Skill shows you how to configure NeighborLoader with num_neighbors matching your layer count and slice seed-node outputs correctly. ## Quick Start Ask the assistant to build a two-layer GCN for node classification on the Cora dataset using PyTorch Geometric.

Frequently Asked Questions about torch-geometric

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a GNN with PyTorch Geometric?

Stack convolution layers from torch_geometric.nn such as GCNConv or SAGEConv inside a torch.nn.Module, and apply activation functions yourself after each layer since PyG conv layers do not include them. Forward passes take x and edge_index as arguments.

How to train a GNN on a large graph that does not fit in GPU memory?

Use NeighborLoader to sample a fixed number of neighbors per hop, with num_neighbors list length matching your GNN depth. Only the first batch.batch_size nodes in each batch are seed nodes, so slice predictions and labels accordingly when computing loss.

What is the correct edge_index format in PyTorch Geometric?

edge_index must be a [2, num_edges] LongTensor in COO format where row 0 holds source nodes and row 1 holds target nodes. If your edges are stored as rows of pairs, transpose and call .contiguous() before use.

Does PyTorch Geometric support heterogeneous graphs?

Yes, HeteroData stores multiple node and edge types keyed by type strings and triplets. Build models with to_hetero() conversion, HeteroConv wrappers per edge type, or native operators like HGTConv.

Why is my GNN layer output missing activations in PyG?

PyG convolution layers deliberately exclude activation functions for flexibility, so you must apply ReLU or other activations manually after each layer. Forgetting this is one of the most common PyG mistakes.

How do I explain GNN predictions with PyTorch Geometric?

Use torch_geometric.explain.Explainer with algorithms like GNNExplainer, PGExplainer, or CaptumExplainer, configuring explanation_type, mask types, and model_config. Explanations support visualization of important subgraphs and feature importance.