Skip to main content

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

lru_cell = LightRecurrentUnitCell(256)

x = torch.randn(2, 256)
hidden = torch.randn(2, 256)

next_hidden = lru_cell(x, hidden) # (2, 256)

Single layer

import torch
from light_recurrent_unit_pytorch import LightRecurrentUnitLayer

lru_layer = LightRecurrentUnitLayer(256)

x = torch.randn(2, 1024, 256)

output = lru_layer(x) # (2, 1024, 256)
assert x.shape == output.shape

Stacked

import torch
from light_recurrent_unit_pytorch import LightRecurrentUnit

lru = LightRecurrentUnit(256, depth = 4)

x = torch.randn(2, 1024, 256)

out = lru(x)

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


Download files

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

Source Distribution

light_recurrent_unit_pytorch-0.0.9.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

File details

Details for the file light_recurrent_unit_pytorch-0.0.9.tar.gz.

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.9.tar.gz
Algorithm Hash digest
SHA256 32c43f22dc8b0791ad8390aa8bfb0517bf81432d35740cfcb839982bf8847a87
MD5 6b6ca30368e3a05c68b660bf44ff4c09
BLAKE2b-256 0724020c74143c8aa6fa935f32a359fd28d8bcc8361836c51bbfcb04e2f54959

See more details on using hashes here.

File details

Details for the file light_recurrent_unit_pytorch-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ccc41c1b1b40e83268756e460017253af0a4ef027625a9e50c872a501f9ba82b
MD5 2efb53a7bbc71c416a6e984b3cce43ee
BLAKE2b-256 cb5a769d3fc89052beb4f723df546d0b28bd0ee189b3e0c8ced87092ed5b46b7

See more details on using hashes here.

Supported by

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