torch-geometric
Guide for building Graph Neural Networks with PyTorch Geometric (PyG). Use this skill whenever the user asks about graph neural networks, GNNs, node classification, link prediction, graph classification, message passing networks, heterogeneous graphs, neighbor sampling, or any task involving torch_geometric / PyG. Also trigger when you see imports from torch_geometric, or the user mentions graph convolutions (GCN, GAT, GraphSAGE, GIN), graph data structures, or working with relational/network data. Even if the user just says 'graph learning' or 'geometric deep learning', use this skill.
npx skills add BioTender-max/awesome-bio-agent-skills --skill torch-geometric --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# PyTorch Geometric (PyG) PyG is the standard library for Graph Neural Networks built on PyTorch. It provides data structures for graphs, 60+ GNN layer implementations, scalable mini-batch training, and support for heterogeneous graphs. Install: `uv add torch_geometric` (or `uv pip install torch_geometric`; requires PyTorch). Optional: `pyg-lib`, `torch-scatter`, `torch-sparse`, `torch-cluster` for accelerated ops. ## Core Concepts ### Graph Data: `Data` and `HeteroData` A graph lives in a `Data` object. The key attributes: ```python from torch_geometric.data import Data data = Data( x=node_features, # [num_nodes, num_node_features] edge_index=edge_index, # [2, num_edges] — COO format, dtype=torch.long edge_attr=edge_features, # [num_edges, num_edge_features] y=labels, # node-level [num_nodes, *] or graph-level [1, *] pos=positions, # [num_nodes, num_dimensions] (for point clouds/spatial) ) ``` **`edge_index` format is critical**: it's a `[2, num_edges]` tensor where `edge_index[0]` = source nodes, `edge_index[1]` = target nodes. It is NOT a list of tuples. If you have edge pairs as rows, transpose and call `.contiguous()`: ```python # If edges are [[src1, dst1], [src2, dst2], ...]
- Core Concepts
- Graph Data: Data and HeteroData
- Datasets
- Transforms
- Building GNN Models
- Quick Start: Using Built-in Layers
- Choosing a Conv Layer
- Lazy Initialization
- High-Level Model APIs
- Custom Layers via MessagePassing
- Task-Specific Patterns
- Node Classification
- Graph Classification
- Link Prediction
What does the torch-geometric skill do?
Guide for building Graph Neural Networks with PyTorch Geometric (PyG). Use this skill whenever the user asks about graph neural networks, GNNs, node classification, link prediction, graph classification, message passing networks, heterogeneous graphs, neighbor sampling, or any task involving torch_geometric / PyG. Also trigger when you see imports from torch_geometric, or the user mentions graph convolutions (GCN, GAT, GraphSAGE, GIN), graph data structures, or working with relational/network data. Even if the user just says 'graph learning' or 'geometric deep learning', use this skill.
How do I install it?
Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill torch-geometric --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
