AI Skill MartBrowse skillsPromptsProgramsLearnWhat is a Skill?
← Back to list

PyTorch Geometric (PyG) Graph Neural Network Guide

A hands-on PyG skill covering node/link/graph tasks, custom message passing, heterogeneous graphs, and neighbor sampling for large graphs.

Dev & CodingAdvanced★ 33,030⑂ 3,248AI score 9/10Last updated: Aug 9, 2026

What it does

  • Nails the PyG fundamentals: Data/HeteroData objects and the critical [2, num_edges] edge_index COO layout.
  • Gives a decision table for conv layers (GCN, GAT/GATv2, SAGE, GIN, TransformerConv, EdgeConv, RGCN, HGT) plus ready training loops for node classification, graph classification, and link prediction.
  • Covers scaling with NeighborLoader, ClusterLoader, GraphSAINTSampler, and DDP guidance.
  • Shows three routes to heterogeneous GNNs (to_hetero(), HeteroConv, native HGTConv) and custom layers via MessagePassing.
  • Includes explainability with torch_geometric.explain and an 8-item pitfalls checklist.

Who it's for

  • ML engineers and researchers building models on graph-structured data.
  • Developers working on recommenders, knowledge graphs, or molecular property prediction.
  • PyG newcomers who keep tripping over edge formats, batching, or lazy initialization.

Example uses

  1. "Train a 2-layer GCN on Cora" → Planetoid loading, mask-based training and evaluation loop.
  2. "Build a user–movie heterogeneous link prediction model" → HeteroData construction, to_hetero() conversion, LinkNeighborLoader.
  3. "My 2M-node graph won't fit in GPU memory" → NeighborLoader with num_neighbors=[15, 10] and correct seed-node slicing for the loss.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/HEAD/skills/torch-geometric/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
↓ Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on AI Skill Mart.
Copy the skills/torch-geometric folder from the GitHub repo K-Dense-AI/scientific-agent-skills into my ~/.claude/skills/torch-geometric/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/K-Dense-AI/scientific-agent-skills.git && mkdir -p ~/.claude/skills && cp -r scientific-agent-skills/skills/torch-geometric ~/.claude/skills/

⚠ This is a third-party skill. Check the source repository before installing.

  1. Open a terminal and clone the repository: git clone https://github.com/K-Dense-AI/scientific-agent-skills.git
  2. Create the skills folder if needed: mkdir -p ~/.claude/skills
  3. Copy just this skill: cp -r scientific-agent-skills/skills/torch-geometric ~/.claude/skills/
  4. Verify the bundled references/ markdown files came along.
  5. Install the libraries in your environment: pip install torch then pip install torch_geometric (Python 3.10+, PyTorch 2.6+ recommended).
  6. Restart Claude Code and ask something like "build a PyG graph classification model" to trigger the skill.