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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.10.tar.gz
Algorithm Hash digest
SHA256 238caa209afa1880e0ffcfa648a8697a9ce5f6cfa5a0d784c89cfac202d16a0a
MD5 d11f1ed29a211bc3489dcc4796c31135
BLAKE2b-256 1466c537b50417f7b221a1a5495282f36561a3270420ae76231fc61e28bb2bc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 123cbce7db44c3d8c57132bf15fd7010ab38170d6b2a18ea3b330c7f93501900
MD5 fe219ab732653b860a0bf514dedfe0eb
BLAKE2b-256 47e8cf06cb0d534154f3cbcd53da1cb951f8db4883ea3602bcdffb1060ac691c

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