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
File details
Details for the file light_recurrent_unit_pytorch-0.1.0.tar.gz
.
File metadata
- Download URL: light_recurrent_unit_pytorch-0.1.0.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 | 5aad109529c81241eb02cdd164d17ba48ef4f9132649c23a5601131c7689e141 |
|
MD5 | 49c29d7da8ff5bfd94793767a1759619 |
|
BLAKE2b-256 | 7052a16cfd92019f74fa74ce1565b2f4b6600164ba07b2eea0bbaee7ef89c3a9 |
File details
Details for the file light_recurrent_unit_pytorch-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: light_recurrent_unit_pytorch-0.1.0-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 | d970ee628d4852b440800da0e35af1fd82659aa87f78c9a69070a7497d5c65c9 |
|
MD5 | f1351006c96a1f2d6dedd5a6b92401ef |
|
BLAKE2b-256 | b532cfab78e32c0f066de84be677274673200a43f5abca994f6a734202218112 |