https://github.com/lgaspard/brc
PyTorch implementation of the bistable recurrent cell (BRC) and recurrently neuromodulated bistable recurrent cell (nBRC)
https://github.com/lgaspard/brc
bistability bistable-recurrent-cell brc pytorch pytorch-implementation recurrent-neural-network rnn
Last synced: about 1 month ago
JSON representation
PyTorch implementation of the bistable recurrent cell (BRC) and recurrently neuromodulated bistable recurrent cell (nBRC)
- Host: GitHub
- URL: https://github.com/lgaspard/brc
- Owner: lgaspard
- License: mit
- Created: 2021-07-17T14:58:24.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-06T14:57:10.000Z (almost 5 years ago)
- Last Synced: 2025-03-23T16:29:29.830Z (about 1 year ago)
- Topics: bistability, bistable-recurrent-cell, brc, pytorch, pytorch-implementation, recurrent-neural-network, rnn
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyTorch Implementation of (n)BRC
PyTorch implementation of the bistable recurrent cell (BRC) and recurrently
neuromodulated bistable recurrent cell (nBRC).
The available classes, `BRCLayer`, `nBRCLayer`, `BRC` and `nBRC`, are
documented in [brc.py](brc.py).
## Download
```
git clone https://github.com/lgaspard/brc
cd brc/
```
## Example usage
See [main.py](main.py) for a *copy-first-input* benchmark with the BRC cell.
```
python3 main.py
```
## Notes
The implementation is similar to that of `torch.nn.GRU`, such that the output
of the RNN is its hidden state. A small wrapper is proposed in
[main.py](main.py) to add a linear layer on top of the recurrent cell.
Also note that the parameter `train_h0` allows to make the initial hidden state
a trainable parameter of the recurrent cell.