Skip to main content

A package for recurrent neural networks in PyTorch

Project description

TorchRecurrent

PyPI codecov Build Docs !python-versions code style: black

TorchRecurrent is a PyTorch-compatible collection of recurrent neural network cells and layers from across the research literature. It aims to provide a unified, flexible interface that feels like native PyTorch while exposing more customization options.

Installation

pip install torchrecurrent

Coming soon to conda-forge as well!

Features

  • 🔄 30+ recurrent cells (e.g. LSTMCell, GRUCell, and many specialized variants).
  • 🏗️ 30+ recurrent layers (e.g. LSTM, GRU, and counterparts for each cell).
  • 🧩 Unified API — all cells/layers follow the PyTorch interface but add extra options for initialization and customization.
  • 📚 Comprehensive documentation including API reference and a catalog of published models.

👉 Full model catalog: torchrecurrent Models

Quick Example

import torch
from torchrecurrent import MGU #minimal gated unit

# sequence: (time_steps, batch, input_size)
inp = torch.randn(5, 3, 10)

# initialize a MGU with hidden_size=20
rnn = MGU(input_size=10, hidden_size=20, num_layers=3)

# forward pass
out, hidden = rnn(inp)

print(out.shape)  # (time_steps, batch, hidden_size)

See also

LuxRecurrentLayers.jl: Provides recurrent layers for Lux.jl in Julia.

RecurrentLayers.jl: Provides recurrent layers for Flux.jl in Julia.

ReservoirComputing.jl: Reservoir computing utilities for scientific machine learning. Essentially gradient free trained recurrent neural networks.

License

This project’s own code is distributed under the MIT License (see LICENSE). The primary intent of this software is academic research.

Third-party Attributions

Some cells are re-implementations of published methods that carry their own licenses:

Please consult each of those licenses for your obligations when using this code in commercial or closed-source settings.

⚠️ Disclaimer: TorchRecurrent is an independent project and is not affiliated with the PyTorch project or Meta AI. The name reflects compatibility with PyTorch, not any official endorsement.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchrecurrent-0.1.10.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchrecurrent-0.1.10-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file torchrecurrent-0.1.10.tar.gz.

File metadata

  • Download URL: torchrecurrent-0.1.10.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torchrecurrent-0.1.10.tar.gz
Algorithm Hash digest
SHA256 c438f2d95b5e80cf1057cc4dbf0cb7fa37c3607fed3a70f4082bf106012286ed
MD5 92f144f14f226386615f44d97c066626
BLAKE2b-256 c33f75081d0cc3cf70ccc235ccda80ef4380d5fe5c7fe8bce9fe59ee92952490

See more details on using hashes here.

File details

Details for the file torchrecurrent-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for torchrecurrent-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 24b1237609cf01696bc8c71ad534069040ad565af725ef2526570d865da9f497
MD5 abbb9524f9118ba3e092123826e72bf7
BLAKE2b-256 364dc14489a3293e9bf7413731960df86957c90ef43a61d0b70067cf98f7833e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page