Skip to main content

LRU TensorFlow implementation

Project description

lru_unofficial

LRU implementation in TensorFlow 2.0. The LRU was introduced in Resurrecting Recurrent Neural Networks for Long Sequences at ICML, and belongs to the state-space models family, which are models able to handle extremely long sequences more gracefully than attention based architectures. You can find here the JAX implementation that we took as a reference, as recommended by one of the authors.

JAX and PyTorch implementations to come. However, parallel scans are not implemented native in PyTorch, as noted here. However custom implementations exist, such as this one.

We implement the LRU unit and also the final LRU residual block used in the paper. For both we provide a recurrent form and a scan form. In our tests, the scan form was up to 300x faster than the recurrent form on a GPU, giving the same output. You can install the package with pip instal lruun. After that, you can import the layers as follows:

from lruun.tf import LinearRecurrentUnitCell, LinearRecurrentUnitFFN
from lruun.tf import ResLRUCell, ResLRUFFN

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

lruun-0.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lruun-0.0.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file lruun-0.0.2.tar.gz.

File metadata

  • Download URL: lruun-0.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for lruun-0.0.2.tar.gz
Algorithm Hash digest
SHA256 70706ccfad11ad99c70917ae6f7c22052f4c12fb1b0006d4ef98e8bfcd66c41d
MD5 ea8d146ff67050e32c2e042120ee2cda
BLAKE2b-256 0c4e2ba0c0789986d4dfacdeefef6af98a256d23f763a78ee6fe451c0db565b7

See more details on using hashes here.

File details

Details for the file lruun-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: lruun-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for lruun-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 074c552d1e03f2ac8183f699754955561bdf4e357f5878b0c13bbabd876b6748
MD5 88e9e7554ddff4c3bd341be24c926b3d
BLAKE2b-256 2ca41d7ff0e9d3c93e14a7783a327de6a36d758390532ac40b44d501d7e4175e

See more details on using hashes here.

Supported by

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