MCPcopy Index your code
hub / github.com/benedekrozemberczki/pytorch_geometric_temporal

github.com/benedekrozemberczki/pytorch_geometric_temporal @0.56.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.56.0 ↗ · + Follow
775 symbols 2,190 edges 84 files 182 documented · 23% updated 40d ago0.56.0 · 2025-03-28★ 2,99128 open issues

Browse by type

Functions 680 Types & classes 95
What it actually does AI analysis from the code graph — generated when you open this
loading…
README


PyPI Version Docs Status Code Coverage Build Status Arxiv benedekrozemberczki

Documentation | External Resources | Datasets

PyTorch Geometric Temporal is a temporal (dynamic) extension library for PyTorch Geometric.

The library consists of various dynamic and temporal geometric deep learning, embedding, and spatio-temporal regression methods from a variety of published research papers. Moreover, it comes with an easy-to-use dataset loader, train-test splitter and temporal snaphot iterator for dynamic and temporal graphs. The framework naturally provides GPU support. It also comes with a number of benchmark datasets from the epidemological forecasting, sharing economy, energy production and web traffic management domains. Finally, you can also create your own datasets.

PyTorch Geometric Temporal now includes support for index-batching - a new batching technique that improves spatiotemporal memory efficiency without any impact on accuracy. Take a look at the index-batching examples, which allow users to easily customize training to their needs and scale to larger datasets than previously possible. Additionally, PyTorch Geometric Temporal supports memory-efficient distributed data parallel training using Dask-DDP in combination with index-batching.

The package interfaces well with Pytorch Lightning which allows training on CPUs, single and multiple GPUs out-of-the-box. Take a look at this introductory example of using PyTorch Geometric Temporal with Pytorch Lightning.

We also provide detailed examples for each of the recurrent models and notebooks for the attention based ones.


Case Study Tutorials

We provide in-depth case study tutorials in the Documentation, each covers an aspect of PyTorch Geometric Temporal’s functionality.

Incremental TrainingEpidemiological Forecasting Case Study

Cumulative TrainingWeb Traffic Management Case Study


Citing

If you find PyTorch Geometric Temporal and the new datasets useful in your research, please consider adding the following citation:

@inproceedings{rozemberczki2021pytorch,
               author = {Benedek Rozemberczki and Paul Scherer and Yixuan He and George Panagopoulos and Alexander Riedel and Maria Astefanoaei and Oliver Kiss and Ferenc Beres and Guzman Lopez and Nicolas Collignon and Rik Sarkar},
               title = {{PyTorch Geometric Temporal: Spatiotemporal Signal Processing with Neural Machine Learning Models}},
               year = {2021},
               booktitle={Proceedings of the 30th ACM International Conference on Information and Knowledge Management},
               pages = {4564–4573},
}

A simple example

PyTorch Geometric Temporal makes implementing Dynamic and Temporal Graph Neural Networks quite easy - see the accompanying tutorial. For example, this is all it takes to implement a recurrent graph convolutional network with two consecutive graph convolutional GRU cells and a linear layer:

import torch
import torch.nn.functional as F
from torch_geometric_temporal.nn.recurrent import GConvGRU

class RecurrentGCN(torch.nn.Module):

    def __init__(self, node_features, num_classes):
        super(RecurrentGCN, self).__init__()
        self.recurrent_1 = GConvGRU(node_features, 32, 5)
        self.recurrent_2 = GConvGRU(32, 16, 5)
        self.linear = torch.nn.Linear(16, num_classes)

    def forward(self, x, edge_index, edge_weight):
        x = self.recurrent_1(x, edge_index, edge_weight)
        x = F.relu(x)
        x = F.dropout(x, training=self.training)
        x = self.recurrent_2(x, edge_index, edge_weight)
        x = F.relu(x)
        x = F.dropout(x, training=self.training)
        x = self.linear(x)
        return F.log_softmax(x, dim=1)

Methods Included

In detail, the following temporal graph neural networks were implemented.

Recurrent Graph Convolutions

Attention Aggregated Temporal Graph Convolutions

Auxiliary Graph Convolutions


Head over to our [documenta

Core symbols most depended-on inside this repo

Shape

Method 524
Function 156
Class 95

Languages

Python100%

Modules by API surface

test/dataset_test.py46 symbols
torch_geometric_temporal/nn/recurrent/dcrnn.py34 symbols
test/batch_test.py32 symbols
torch_geometric_temporal/nn/attention/mtgnn.py30 symbols
torch_geometric_temporal/nn/attention/gman.py27 symbols
torch_geometric_temporal/nn/recurrent/temporalgcn.py24 symbols
torch_geometric_temporal/nn/attention/tsagcn.py23 symbols
torch_geometric_temporal/nn/attention/astgcn.py23 symbols
test/recurrent_test.py19 symbols
torch_geometric_temporal/nn/recurrent/gconv_lstm.py16 symbols
torch_geometric_temporal/nn/recurrent/gc_lstm.py16 symbols
torch_geometric_temporal/nn/hetero/heterogclstm.py16 symbols

For agents

$ claude mcp add pytorch_geometric_temporal \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page