light-recurrent-unit-pytorch


Namelight-recurrent-unit-pytorch JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryLight Recurrent Unit
upload_time2024-08-31 12:31:08
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Phil Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords artificial intelligence deep learning recurrent neural networks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="./lru.png" width="400px"></img>

## Light Recurrent Unit - Pytorch

Implementation of the <a href="https://www.mdpi.com/2079-9292/13/16/3204">Light Recurrent Unit</a> in Pytorch

## Install

```bash
$ pip install light-recurrent-unit-pytorch
```

## Usage

```python
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

```python
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

```python
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

```bibtex
@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}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "light-recurrent-unit-pytorch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "artificial intelligence, deep learning, recurrent neural networks",
    "author": null,
    "author_email": "Phil Wang <lucidrains@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d7/25/15c5465df72f181b608cd814850786f5b721c2596e07783a8e655cf5d878/light_recurrent_unit_pytorch-0.1.1.tar.gz",
    "platform": null,
    "description": "<img src=\"./lru.png\" width=\"400px\"></img>\n\n## Light Recurrent Unit - Pytorch\n\nImplementation of the <a href=\"https://www.mdpi.com/2079-9292/13/16/3204\">Light Recurrent Unit</a> in Pytorch\n\n## Install\n\n```bash\n$ pip install light-recurrent-unit-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom light_recurrent_unit_pytorch import LightRecurrentUnitCell\n\ncell = LightRecurrentUnitCell(256)\n\nx = torch.randn(2, 256)\nhidden = torch.randn(2, 256)\n\nnext_hidden = cell(x, hidden) # (2, 256)\n```\n\nSingle layer\n\n```python\nimport torch\nfrom light_recurrent_unit_pytorch import LightRecurrentUnitLayer\n\nlayer = LightRecurrentUnitLayer(256)\n\nx = torch.randn(2, 1024, 256)\n\nout = layer(x) # (2, 1024, 256)\n\nassert out.shape == x.shape\n```\n\nStacked\n\n```python\nimport torch\nfrom light_recurrent_unit_pytorch import LightRecurrentUnit\n\nlru = LightRecurrentUnit(256, depth = 4)\n\nx = torch.randn(2, 1024, 256)\n\nout, layer_hiddens = lru(x) # (2, 1024, 256), List[(2, 256)]\n\nassert out.shape == x.shape\n```\n\n## Citations\n\n```bibtex\n@Article{electronics13163204,\n    AUTHOR = {Ye, Hong and Zhang, Yibing and Liu, Huizhou and Li, Xuannong and Chang, Jiaming and Zheng, Hui},\n    TITLE = {Light Recurrent Unit: Towards an Interpretable Recurrent Neural Network for Modeling Long-Range Dependency},\n    JOURNAL = {Electronics},\n    VOLUME = {13},\n    YEAR = {2024},\n    NUMBER = {16},\n    ARTICLE-NUMBER = {3204},\n    URL = {https://www.mdpi.com/2079-9292/13/16/3204},\n    ISSN = {2079-9292},\n    DOI = {10.3390/electronics13163204}\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Phil Wang  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Light Recurrent Unit",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://pypi.org/project/light-recurrent-unit-pytorch/",
        "Repository": "https://github.com/lucidrains/light-recurrent-unit-pytorch"
    },
    "split_keywords": [
        "artificial intelligence",
        " deep learning",
        " recurrent neural networks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "267f8a96cff787028f22509f91b390c844f31f9d313c476f892a23d7b8d9063a",
                "md5": "9ddc1d1176ed742e6812014efa9fffeb",
                "sha256": "1a9dad164d13e285a4c55656e76e90efbde99c760862a8b0cc17cdc43074b305"
            },
            "downloads": -1,
            "filename": "light_recurrent_unit_pytorch-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ddc1d1176ed742e6812014efa9fffeb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5403,
            "upload_time": "2024-08-31T12:31:07",
            "upload_time_iso_8601": "2024-08-31T12:31:07.295793Z",
            "url": "https://files.pythonhosted.org/packages/26/7f/8a96cff787028f22509f91b390c844f31f9d313c476f892a23d7b8d9063a/light_recurrent_unit_pytorch-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d72515c5465df72f181b608cd814850786f5b721c2596e07783a8e655cf5d878",
                "md5": "16a203cf9b74aface0068998a77dc81c",
                "sha256": "eef7bfdc0dd622c69ef17d4efb35408add59aa7acb8f7a5feeaaf0117f03ba75"
            },
            "downloads": -1,
            "filename": "light_recurrent_unit_pytorch-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "16a203cf9b74aface0068998a77dc81c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1013497,
            "upload_time": "2024-08-31T12:31:08",
            "upload_time_iso_8601": "2024-08-31T12:31:08.526541Z",
            "url": "https://files.pythonhosted.org/packages/d7/25/15c5465df72f181b608cd814850786f5b721c2596e07783a8e655cf5d878/light_recurrent_unit_pytorch-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-31 12:31:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lucidrains",
    "github_project": "light-recurrent-unit-pytorch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "light-recurrent-unit-pytorch"
}
        
Elapsed time: 0.33001s