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.11.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.11.tar.gz
Algorithm Hash digest
SHA256 eeb2a5712f73fcdec879ca676d56b1b4a234c8ec63b767ddeaa20d20412eda62
MD5 a1c89c27f7e0ee845b8196e854ee2b59
BLAKE2b-256 6ae691aa56d43255b284afe0df945d2b0f2e941145d51a57ecad5821eda68a2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 5c31638900471f57029b8d738186d32dac5cac4632055eb5ace8378e0f520256
MD5 14b57f4a043cf5845850ecc12cf60cca
BLAKE2b-256 63d3dade0d80dcf8f2feb1d30b1bfc1636ed6435ed2a8fb56c9f9286d00ef9f5

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