Skip to main content

A package for recurrent neural networks in PyTorch

Project description

TorchRecurrent

PyPI codecov Build Docs 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.

Project details


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.7.tar.gz (12.5 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.7-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: torchrecurrent-0.1.7.tar.gz
  • Upload date:
  • Size: 12.5 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.7.tar.gz
Algorithm Hash digest
SHA256 5c8aa20399296b89b80b8b6a605c07a58200cc6bc672d2394894dc4651a314e5
MD5 428efa57a43c1fb4a62f155961a121a8
BLAKE2b-256 d6f9a810e832b01c8f45d4449aca14955317620d6c72d49c2e0787955b607809

See more details on using hashes here.

File details

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

File metadata

  • Download URL: torchrecurrent-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torchrecurrent-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e1b8b2b559fb7d5acfdd7a245e31c562e73b2415acf89cf5f766dcd890149d2e
MD5 34f21479993ce56daaf2fe9b688930bb
BLAKE2b-256 30398b63fce0a699035bbb9e931778ff2f445f1d86db20a86b10834b605b00cf

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