Skip to main content

A PyTorch implementation of Comfi-FastGRNN

Project description

fast-ulcnet-torch

Implements Comfi-FastGRNN in torch.

Usage

The ComfiFastGRNN module is designed to be a drop-in replacement for standard PyTorch RNN layers (like nn.LSTM or nn.GRU), but with added support for low-rank factorization and complementary filtering.

Basic Implementation

Here is how to use the layer with default settings in a standard training loop:

import torch
from comfi_fast_grnn_torch import ComfiFastGRNN 

# 1. Initialize the layer
# batch_first=True is the default for this implementation
model = ComfiFastGRNN(
    input_size=32, 
    hidden_size=64, 
    num_layers=1
)

# 2. Create dummy input: (Batch Size, Sequence Length, Input Size)
x = torch.randn(10, 50, 32)

# 3. Forward pass
# Returns output (all timesteps) and final hidden state
output, h_n = model(x)

print(f"Output shape: {output.shape}")  # torch.Size([10, 50, 64])
print(f"Hidden state shape: {h_n.shape}") # torch.Size([1, 10, 64])

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

comfi_fast_grnn_torch-0.0.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

comfi_fast_grnn_torch-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: comfi_fast_grnn_torch-0.0.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for comfi_fast_grnn_torch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3d839edd36e9f80d2a810a656ea023f8d038e18737af8e948f35ae1a7e186f46
MD5 31bf1658772201db4a0b35c6a59d9dbe
BLAKE2b-256 ed36b3d09f170a7f535ffa798b705e6448b353480006073cf330274b3f471328

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for comfi_fast_grnn_torch-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a5db6350c763ef7bd7e8566601cd8c61446bc6c3a96f06051742479453f9ef1
MD5 58ce89293b2270f8f199c93c71b971b0
BLAKE2b-256 ec4aafeef5b64a6bcd436d92c7f6f423c38c15a8b0fcb1ef3e4999b44f68af48

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