Skills torch-geometric
🔺

torch-geometric

Safe ⚙️ External commands📁 Filesystem access⚡ Contains scripts🌐 Network access

Build Graph Neural Networks with PyTorch Geometric

Also available from: davila7

Graph Neural Networks power modern applications like drug discovery, social network analysis, and recommendation systems. This skill provides ready-to-use templates and documentation for implementing GNNs with PyTorch Geometric.

Supports: Claude Codex Code(CC)
🥉 75 Bronze
1

Download the skill ZIP

2

Upload in Claude

Go to Settings → Capabilities → Skills → Upload skill

3

Toggle on and start using

Test it

Using "torch-geometric". Create a GCN model for the Cora citation network

Expected outcome:

  • GCNConv layers with hidden channels
  • Training loop with loss calculation
  • Evaluation on train/val/test masks
  • Model saved to checkpoint file

Using "torch-geometric". Load the TUDataset for graph classification

Expected outcome:

  • TUDataset with ENZYMES loaded to /tmp
  • DataLoader with batch_size=32
  • Global mean pooling layer
  • Training across 100 epochs

Using "torch-geometric". Use attention mechanisms in my GNN

Expected outcome:

  • GATConv with 8 attention heads
  • Dropout applied to attention coefficients
  • ELU activation function
  • Multi-head output concatenated then averaged

Security Audit

Safe
v4 • 1/17/2026

All 777 static findings are false positives. The detected 'eval()' calls are legitimate PyTorch model.eval() methods for evaluation mode, not dynamic code execution. The 'external_commands' findings are markdown code blocks using backtick formatting. The 'weak cryptographic algorithm' flags are triggered by documentation mentioning algorithm names. The 'certificate/key files' flags misidentify error messages referencing TEMPLATES.keys(). No actual security threats identified in this legitimate PyTorch Geometric ML skill.

8
Files scanned
6,721
Lines analyzed
4
findings
4
Total audits
Audited by: claude View Audit History →

Quality Score

68
Architecture
100
Maintainability
87
Content
20
Community
100
Security
78
Spec Compliance

What You Can Build

Build Molecular Property Predictors

Train GNNs on molecular graphs to predict drug properties, toxicity, and binding affinity for drug discovery.

Create Citation Network Classifiers

Implement node classification on citation networks like Cora and PubMed for paper categorization and recommendation.

Analyze Social Networks

Apply graph attention and sampling techniques to large social networks for community detection and influence analysis.

Try These Prompts

Basic GNN Model
Build a Graph Convolutional Network for node classification on the Cora dataset using PyTorch Geometric. Include training loop and evaluation.
Graph Classification
Create a GraphSAGE model for graph classification on the ENZYMES dataset using global mean pooling and DataLoader.
Attention Mechanism
Implement a Graph Attention Network (GAT) with multi-head attention for citation network classification.
Large-Scale Training
Show how to use NeighborLoader for training GNNs on large-scale graphs with mini-batch processing and neighbor sampling.

Best Practices

  • Use model.eval() and torch.no_grad() during inference to disable gradients and ensure deterministic behavior.
  • Apply NeighborLoader with appropriate num_neighbors for large graphs to enable efficient mini-batch training.
  • Save models using torch.save() with state_dict for efficient checkpointing and reproducibility.

Avoid

  • Avoid training on full graphs without sampling for large networks as this causes memory overflow.
  • Do not forget to set model.train() during training phases and model.eval() during evaluation.
  • Avoid hardcoding dataset paths; use root parameter with temporary directories for dataset caching.

Frequently Asked Questions

What is PyTorch Geometric?
PyTorch Geometric (PyG) is a library for deep learning on graphs, extending PyTorch with GNN implementations.
What GNN architectures are supported?
GCN, GAT, GraphSAGE, GraphConv, GINConv, TransformerConv and 40+ other layer types are available.
What datasets can I load?
Planetoid (Cora, CiteSeer, PubMed), TUDataset, Coauthor, Amazon, and many others for benchmarking.
How do I handle large graphs?
Use NeighborLoader for neighbor sampling and mini-batch processing to train on graphs with millions of nodes.
Can I do molecular property prediction?
Yes, use molecular datasets with GINConv or other message passing layers for drug discovery and chemistry tasks.
What transforms are available?
Node transforms (normalization,PCA), edge transforms (distance, adding edges), and graph transforms (connected components).