A PyTorch module for Liquid Neurons
Project description
liquidnn
liquidnn is a PyTorch library for Liquid Neural Networks (LNNs), including multi-layer networks built from liquid neurons.
This library provides an easy interface to use liquid dynamics in your neural networks without needing to handle the underlying neurons directly.
Installation
pip install liquidnn
Usage
import torch
from liquidnn import LiquidNeuralNetwork
# Example: batch=2, seq_len=5, input_size=10
x = torch.randn(2, 5, 10)
# Initialize a multi-layer liquid neural network
model = LiquidNeuralNetwork(
input_size=10,
hidden_size=20,
num_layers=2, # number of stacked liquid layers
tau=0.5, # temporal integration factor
scaling_factor_W=0.05, # weight scaling factor
scaling_factor_U=0.05,
scaling_factor_alpha=0.05
)
# Forward pass
out = model(x)
print(out.shape) # Expected: torch.Size([2, 20])
Parameters
LiquidNeuralNetwork:
input_size (int): Number of input features per timestep.
hidden_size (int): Size of each liquid layer’s hidden state.
num_layers (int, default=1): Number of stacked liquid layers.
tau (float, default=0.5): Temporal integration factor controlling neuron update speed.
scaling_factor_W/U/alpha (float, default=0.05): Scaling factors for internal neuron parameters.
Features
Multi-layer liquid neural networks for sequential data.
Continuous-time neuron update using tau.
Fully compatible with PyTorch modules.
Users can import only LiquidNeuralNetwork; internal neurons are private.
References
--> https://arxiv.org/pdf/2006.00232
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
liquidnn-1.0.1.tar.gz
(3.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liquidnn-1.0.1.tar.gz.
File metadata
- Download URL: liquidnn-1.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9ed0b40aa5a38b7b27c70ef1f2eaa02ee2e0d25c55f7a12921322de4b58c632
|
|
| MD5 |
074182f71a232c1f2d54422e7fbd461f
|
|
| BLAKE2b-256 |
dd188d2926ea571207e8cc793a85efdcc0045aab4eaf995a9ef041ead6a6cdc5
|
File details
Details for the file liquidnn-1.0.1-py3-none-any.whl.
File metadata
- Download URL: liquidnn-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f50817e1a7f2f8f19e6e9626f766251515c53064710cf95eca67d43de682e0a
|
|
| MD5 |
640f51de4b17740d1d6d7ede27d60f45
|
|
| BLAKE2b-256 |
86bfc9afa89b9df949f43b56635d718461167a86aefe9d80997f2b491b48084a
|