Torch Spatiotemporal#

Neural spatiotemporal forecasting with PyTorch

Torch Spatiotemporal (tsl) is a python library for neural spatiotemporal data processing, with a focus on Graph Neural Networks.

It is built upon the most used libraries of the python scientific computing ecosystem, with the final objective of providing a straightforward process that goes from data preprocessing to model prototyping. In particular, tsl offers a wide range of utilities to develop neural networks in PyTorch and PyG for processing spatiotemporal data signals.

In detail, the package provide:

  • High-level and easy-to-use APIs to build you own datasets and models for sensor networks.

  • Tools to deal with irregularities in the data stream: missing data, variations in the underlying network, etc.

  • Automatization of the preprocessing phase, with methods to scale and detrend the time series (see Preprocessing section).

  • A set of most used datasets in spatiotemporal data processing literature (see Datasets section).

  • A straightforward way of building spatiotemporal datasets that work with PyTorch and PyG (see Data structures section).

  • Out-of-the-box scalability – from a single CPU to clusters of GPUs – with PyTorch Lightning (see Inference engines section).

  • Plug-and-play state-of-the-art models from neural spatiotemporal literature (see Models section).

  • A collection of neural layers for creating neural spatiotemporal models in a fast and modular way (see Layers section).

  • A standard for experiment reproducibility based on the Hydra framework, to promote and support research on spatiotemporal data mining (see Experiment section).

“If I have seen further it is by standing on the shoulders of Giants.”

—Isaac Newton

tsl relies heavily on these libraries for its functionalities:

Get started#


Read the guide on how to to install tsl on your system.


Look at the basic functionalities of tsl for spatiotemporal data processing.


Check the notebooks for tutorial to use tsl at the best.

Package API

In the index, you can find the main API for each submodule.