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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.6.tar.gz
Algorithm Hash digest
SHA256 bccebcfd2533e389cb2d471e0c359555504d618f2b0315df068b3c3a94fa648e
MD5 1b3c1f03d1c0b331e52887e33c89c61e
BLAKE2b-256 dee2b018af65d3c43bb8def9ea8398e94d42a5959a937ec58928fdd8fb3df95d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_recurrent_unit_pytorch-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b2bf595aa54056bca5603f26fc421ad402ced32fa1ff4da023dd25f56723070d
MD5 941d2768f2f669ebe5e40d69147c0d35
BLAKE2b-256 74e80ceecdcdde39d33784f9e80269b4244293e9be93721c366b46b187ba05a6

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