Skip to main content

SPD Learn Logo

Deep Learning on Symmetric Positive Definite Matrices

SPD Learn is a pure PyTorch library for geometric deep learning on Symmetric Positive Definite (SPD) matrices.
The library provides differentiable Riemannian operations, broadcast-compatible layers, and reference implementations of published neural network architectures for SPD data.

Docs • Install • Examples • API

Python License PyTorch GitHub Stars


Why SPD Learn?

A PyTorch library providing differentiable Riemannian operations and neural network layers for SPD matrix-valued data.

🐍 Pure PyTorch 🌐 Riemannian Geometry 📦 Model Zoo
Built entirely on PyTorch for seamless integration, automatic differentiation, and GPU acceleration out of the box. Efficient exponential maps, logarithms, parallel transport, and geodesic distance computations on SPD manifolds. Implementations of SPDNet, TensorCSPNet, EEGSPDNet, TSMNet, and more state-of-the-art architectures.

Model Architectures

State-of-the-art deep learning models for SPD matrix data.

Model Description Tags
SPDNet The foundational architecture for deep learning on SPD manifolds. Performs dimension reduction while preserving the SPD structure. BiMap ReEig LogEig
EEGSPDNet Specialized for EEG signal classification. Combines covariance estimation with SPD network layers for BCI applications. Covariance BiMap ReEig
TSMNet Tangent Space Mapping Network combining convolutional features with SPD batch normalization. BatchNorm LogEig Transfer
TensorCSPNet SPDNet variant with Tensor Common Spatial Patterns for multi-band EEG feature extraction. Multi-band CSP BiMap
PhaseSPDNet Phase-based SPDNet that leverages instantaneous phase information from analytic signals. Phase Hilbert BiMap
GREEN Gabor Riemann EEGNet combining Gabor wavelets with Riemannian geometry for robust EEG decoding. Gabor Wavelet Shrinkage

Key Features

Core components for constructing and training geometric neural networks on SPD manifolds.

  • SPD Layers — Specialized neural network layers for SPD matrices: BiMap for bilinear mappings, ReEig for eigenvalue rectification, and LogEig for tangent space projection.
  • Riemannian Operations — Complete toolkit for SPD manifold computations: exponential/logarithmic maps, geodesic distances, Log-Euclidean mean, and geodesic interpolation.
  • GPU Accelerated — Full CUDA support with efficient batched operations. Leverage PyTorch's automatic differentiation for seamless gradient computation on manifolds.
  • scikit-learn Compatible — Seamlessly integrate with scikit-learn pipelines, cross-validation, and hyperparameter tuning via skorch/Braindecode wrappers.
  • Batch Normalization — SPD-specific batch normalization layers that respect the Riemannian geometry, enabling stable training of deep SPD networks.
  • Open Source — BSD-3 licensed, actively maintained, and welcoming contributions. Comprehensive documentation and examples to get you started quickly.

Getting Started

Three simple steps to start using SPD Learn.

1. Install

pip install spd_learn

Or install from source:

git clone https://github.com/spdlearn/spd_learn
cd spd_learn && pip install -e .

Works with Python 3.11+ and PyTorch 2.0+.

2. Import & Create

from spd_learn.models import SPDNet
from spd_learn.modules import BiMap, ReEig

# Create your model
model = SPDNet(n_chans=22, n_outputs=4, subspacedim=16)

3. Train & Evaluate

import torch

# Standard PyTorch training
optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)

for epoch in range(100):
    output = model(X_train)
    loss = criterion(output, y_train)
    loss.backward()
    optimizer.step()

Ecosystem Integration

Works seamlessly with your favorite tools.

  • PyTorch — Built entirely on PyTorch 2.0+
  • scikit-learn — ML pipelines and cross-validation (via skorch/Braindecode wrappers)
  • Braindecode — Deep learning for EEG
  • MOABB — EEG benchmark datasets
  • pyRiemann — Riemannian geometry for BCI

Citation

If you use SPD Learn in your research, please cite:

@article{aristimunha2025spdlearn,
  title     = {SPDlearn: A Geometric Deep Learning Python Library for Neural
               Decoding Through Trivialization},
  author    = {Aristimunha, Bruno and Ju, Ce and Collas, Antoine and
               Bouchard, Florent and Thirion, Bertrand and
               Chevallier, Sylvain and Kobler, Reinmar},
  journal   = {To be submitted},
  year      = {2026},
  url       = {https://github.com/spdlearn/spd_learn}
}

Open Source & Community Driven

SPD Learn is an open-source project contributed by researchers for researchers. Join our community and help advance deep learning on Riemannian manifolds.

Supported by

Inria     CNRS     CEA     Université Paris-Saclay     ATR     USMB


License

This project is licensed under the BSD 3-Clause License, unless the header of the code section explicitly states otherwise. See LICENSE.txt for details.

Metadata

Release files for spd-learn 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spd-learn 0.2.0
File Size Uploaded
spd_learn-0.2.0.tar.gz 125.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spd-learn 0.2.0
File Interpreter ABI Platform
spd_learn-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 240.3 kB

Release files / spd_learn-0.2.0.tar.gz

Download URL spd_learn-0.2.0.tar.gz
Size 125.0 kB
Tags Source
SHA-256 checksum
How to use checksums
22f099e33ec331eadd377a4c540aba81c3cec632eb450aa821542cf0cc7d4014
BLAKE2b-256 checksum
How to use checksums
8fdad9bfbe5b4b5e41952a5851f3b4af9c350929a448100f2c4d27c33b6f6161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / spd_learn-0.2.0-py3-none-any.whl

Download URL spd_learn-0.2.0-py3-none-any.whl
Size 115.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b24590fc2cf5d9545d305e512ca7b80cbaf9696299a133b2db47fd7836c9658b
BLAKE2b-256 checksum
How to use checksums
b976350a5dcf13f467ad8e6a392123205994392cc880c51e627736a217e0b71f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page