Light Recurrent Unit
Project description
Light Recurrent Unit - Pytorch
Implementation of the Light Recurrent Unit in Pytorch
Install
$ pip install light-recurrent-unit-pytorch
Usage
import torch
from light_recurrent_unit_pytorch import LightRecurrentUnitCell
cell = LightRecurrentUnitCell(256)
x = torch.randn(2, 256)
hidden = torch.randn(2, 256)
next_hidden = cell(x, hidden) # (2, 256)
Single layer
import torch
from light_recurrent_unit_pytorch import LightRecurrentUnitLayer
layer = LightRecurrentUnitLayer(256)
x = torch.randn(2, 1024, 256)
out = layer(x) # (2, 1024, 256)
assert out.shape == x.shape
Stacked
import torch
from light_recurrent_unit_pytorch import LightRecurrentUnit
lru = LightRecurrentUnit(256, depth = 4)
x = torch.randn(2, 1024, 256)
out, layer_hiddens = lru(x) # (2, 1024, 256), List[(2, 256)]
assert out.shape == x.shape
Citations
@Article{electronics13163204,
AUTHOR = {Ye, Hong and Zhang, Yibing and Liu, Huizhou and Li, Xuannong and Chang, Jiaming and Zheng, Hui},
TITLE = {Light Recurrent Unit: Towards an Interpretable Recurrent Neural Network for Modeling Long-Range Dependency},
JOURNAL = {Electronics},
VOLUME = {13},
YEAR = {2024},
NUMBER = {16},
ARTICLE-NUMBER = {3204},
URL = {https://www.mdpi.com/2079-9292/13/16/3204},
ISSN = {2079-9292},
DOI = {10.3390/electronics13163204}
}
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 light_recurrent_unit_pytorch-0.1.1.tar.gz.
File metadata
- Download URL: light_recurrent_unit_pytorch-0.1.1.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eef7bfdc0dd622c69ef17d4efb35408add59aa7acb8f7a5feeaaf0117f03ba75
|
|
| MD5 |
16a203cf9b74aface0068998a77dc81c
|
|
| BLAKE2b-256 |
d72515c5465df72f181b608cd814850786f5b721c2596e07783a8e655cf5d878
|
File details
Details for the file light_recurrent_unit_pytorch-0.1.1-py3-none-any.whl.
File metadata
- Download URL: light_recurrent_unit_pytorch-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9dad164d13e285a4c55656e76e90efbde99c760862a8b0cc17cdc43074b305
|
|
| MD5 |
9ddc1d1176ed742e6812014efa9fffeb
|
|
| BLAKE2b-256 |
267f8a96cff787028f22509f91b390c844f31f9d313c476f892a23d7b8d9063a
|