A package for recurrent neural networks in PyTorch
Project description
TorchRecurrent
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:
- NASCell: originally available under Apache 2.0 — see LICENSE-Apache2.0.txt.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchrecurrent-0.1.8.tar.gz.
File metadata
- Download URL: torchrecurrent-0.1.8.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac67fce534f3df99e7f127ff706e23637dbaa9347c3bf47a2971c6c7965f7ee5
|
|
| MD5 |
f9515aa9e9ea243f0163ce581e6ea141
|
|
| BLAKE2b-256 |
475f01a3b8bd18275647204f34bcc040bd16f107da08aa7135370f61276d53f7
|
File details
Details for the file torchrecurrent-0.1.8-py3-none-any.whl.
File metadata
- Download URL: torchrecurrent-0.1.8-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c016e5d9879a415c970e7ca254ceb8dde49a92167a8c74d2a96e47e963922cfa
|
|
| MD5 |
a96a9d8e2c7b95d4477877f85dd13e52
|
|
| BLAKE2b-256 |
29f544cb81a2a165fa3636cef27cff14f22079a91381585c5e18790310c5ed3a
|