torch-geometric

Build and train graph neural networks with PyTorch.

Updated May 17, 2026
One-click install
npx skills add https://github.com/galeep/plugin-place --skill torch-geometric-galeep
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: torch-geometric
Source: https://github.com/galeep/plugin-place/tree/main/plugins/sci-machine-learning/skills/torch-geometric
Command: npx skills add https://github.com/galeep/plugin-place --skill torch-geometric-galeep

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, torch-geometric, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive set of tools for building and training graph neural networks (GNNs) using PyTorch, addressing the challenges of working with graph-structured data.

Core Features & Use Cases

  • Graph Data Structures: Efficiently represent and manipulate graph data with built-in data structures.
  • GNN Layers: Implement a wide range of GNN layers including GCN, GAT, SAGE, GIN, and more.
  • Mini-Batch Training: Scale GNN training to large graphs using mini-batch strategies.
  • Heterogeneous Graphs: Handle multi-type nodes and edges with ease.
  • Use Case: Ideal for tasks like node classification, graph classification, link prediction, and more, where the data is naturally represented as a graph.

Quick Start

Use the torch-geometric skill to build a simple GCN model for node classification:

import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv

class GCN(torch.nn.Module):
    def __init__(self, in_channels, hidden_channels, out_channels):
        super().__init__()
        self.conv1 = GCNConv(in_channels, hidden_channels)
        self.conv2 = GCNConv(hidden_channels, out_channels)

    def forward(self, x, edge_index):
        x = self.conv1(x, edge_index).relu()
        x = F.dropout(x, p=0.5, training=self.training)
        x = self.conv2(x, edge_index)
        return x

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 graph neural network with PyTorch for node classification?

To build a graph neural network for node classification with PyTorch, use built-in GNN layers like GCNConv to process graph-structured data and generate node-level predictions. You can stack multiple layers to extract graph features.

Can I train graph neural networks on large graphs using mini-batches?

Yes, you can train graph neural networks on large graphs using mini-batch strategies. This approach scales GNN training by processing subsets of nodes and edges, making it feasible to handle massive graph-structured data efficiently.

Does this PyTorch graph neural network skill support heterogeneous graphs?

Yes, this PyTorch graph neural network skill supports heterogeneous graphs. It provides built-in data structures to easily handle graphs containing multiple types of nodes and edges within the same network structure.

What is the best way to perform link prediction on graph-structured data in PyTorch?

The best way to perform link prediction on graph-structured data in PyTorch is by using specialized GNN layers to learn node embeddings. These embeddings capture structural relationships to accurately predict missing or future edges.

Do I need a specific PyTorch version to use graph neural network layers like GAT and SAGE?

Yes, you need PyTorch 2.6 or higher and torch-geometric 2.7.x or higher to use GNN layers like GAT and SAGE. The environment also requires Python 3.10 or above to run properly.

What are the limitations when scaling graph classification models to large datasets?

When scaling graph classification models, limitations arise from memory constraints when loading entire large graphs. To overcome this, use mini-batch training strategies to partition graph-structured data into manageable batches.