Skip to main content

Spiking Attention Network model

Project description

sanet

Spiking Attention Network (sanet) model package. PyPI version Supported Python versions PyPI downloads Licence Code style: Black

Paper: Spiking Attention Network: A Hybrid Neuromorphic Approach to Underwater Acoustic Localization and Zero-shot Adaptation

Install

pip3 install sanet

Or

uv add sanet

Usage

Minimal

import torch
import sanet

model = sanet.SA_NET()

batch_size = 2
time_steps = 1500
x = torch.randn(batch_size, time_steps, 21)

with torch.no_grad():
	y = model(x)
	# expected torch.Size([2, 1])

print(y.shape)

All Parameters

import torch
import sanet

model = sanet.SA_NET(
	input_channels=21,
	output_channels=1,
	middle_channels=11,
	seed=42,
	spike_slope=25,
	lif1_beta=0.9956,
	lif2_beta=0.9821,
	lif3_beta=0.930,
	conformer_dim=512,
	conformer_depth=2,
	conformer_dim_head=64,
	conformer_heads=8,
	conformer_ff_mult=4,
	conformer_conv_expansion_factor=2,
	conformer_conv_kernel_size=24,
	conformer_attn_dropout=0.1,
	conformer_ff_dropout=0.1,
	conformer_conv_dropout=0.1,
	dropout_p1=0.0,
	dropout_p2=0.1,
	dropout_p3=0.1,
	dropout_p4=0.1,
)

batch_size = 2
time_steps = 1500
x = torch.randn(batch_size, time_steps, 21)

with torch.no_grad():
    y = model(x)
    # expected torch.Size([2, 1])

print(y.shape)

Model Notes

  • Input tensor shape: [batch, time, channels]
  • The forward pass applies per-channel standardization before the backbone.
  • The network uses ResNet-style 1D blocks, spiking neurons, and Conformer layers.
  • Model initialization sets a deterministic seed (Python, NumPy, and PyTorch) and enables deterministic CUDA behavior.

Architecture Diagram

flowchart TB
	A["Input (batch, time, channels)"] --> B["Per-channel Standardization"]

	subgraph Backbone
		C["ResNet1 + MaxPool + Dropout (p1)"] --> D["LIF1 Spiking"]
		D --> E["ResNet2 + MaxPool + Dropout (p2)"]
		E --> F["LIF2 Spiking"]
		F --> G["ResNet3 + MaxPool + Dropout (p3)"]
		G --> H["LIF3 Spiking"]
		H --> I["ResNet4 + MaxPool + Dropout (p4)"]
	end

	B --> C
	I --> J["Conformer Stack"]
	J --> K["Multilayer Perceptron"]
	K --> L["Output"]

Parameters

  • input_channels (default: 21): Number of input channels.
  • output_channels (default: 1): Number of output channels.
  • middle_channels (default: 11): Number of intermediate channels before the final projection.
  • seed (default: 42): Random seed for reproducibility.
  • spike_slope (default: 25): Slope for the surrogate spike gradient.
  • lif1_beta, lif2_beta, lif3_beta (default: 0.9956, 0.9821, 0.930): Decay rates for spiking neurons.
  • conformer_dim (default: 512): Conformer model dimension.
  • conformer_depth (default: 2): Number of Conformer blocks.
  • conformer_dim_head (default: 64): Attention head dimension.
  • conformer_heads (default: 8): Number of attention heads.
  • conformer_ff_mult (default: 4): Feedforward expansion multiplier.
  • conformer_conv_expansion_factor (default: 2): Conformer conv expansion factor.
  • conformer_conv_kernel_size (default: 24): Conformer conv kernel size.
  • conformer_attn_dropout (default: 0.1): Attention dropout in Conformer.
  • conformer_ff_dropout (default: 0.1): Feedforward dropout in Conformer.
  • conformer_conv_dropout (default: 0.1): Convolution dropout in Conformer.
  • dropout_p1, dropout_p2, dropout_p3, dropout_p4 (default: 0.0, 0.1, 0.1, 0.1): Dropout probabilities for the 1D dropout layers.

Citation

If you find this package useful, please consider citing our paper:

@inproceedings{vo2026sa-net,
	title={Spiking Attention Network: A Hybrid Neuromorphic Approach to Underwater Acoustic Localization and Zero-shot Adaptation},
	author={Vo, Quoc Thinh and Han, David K},
	booktitle={2026 51st IEEE International Conference on Acoustics, Speech, and Signal Processing (ICASSP)},
	pages={1--5},
	year={2026},
	organization={IEEE}
}

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

sanet-1.0.11.tar.gz (112.1 kB view details)

Uploaded Source

Built Distribution

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

sanet-1.0.11-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file sanet-1.0.11.tar.gz.

File metadata

  • Download URL: sanet-1.0.11.tar.gz
  • Upload date:
  • Size: 112.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sanet-1.0.11.tar.gz
Algorithm Hash digest
SHA256 7f6a622474fd78a86d5644ccbe765e4d2a279f979306185d71f8660e98124f6b
MD5 e6f9a649f716ca9597fe2a3018b8264a
BLAKE2b-256 2aea5f88f5a7b0cdbc9332abc664c3a74a1088a20fe56e6fbd27514ef7a983c8

See more details on using hashes here.

File details

Details for the file sanet-1.0.11-py3-none-any.whl.

File metadata

  • Download URL: sanet-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sanet-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 d698179b486f51369bbd6cb3fe94786b8c57ad22d7c5633025c6b084bca62e7e
MD5 f093dc7fbfd836460c44a7fca2ba8831
BLAKE2b-256 6cae8f80fabeaf9a01cf03635a1c67bb4afd1e08479f2d244ee288bad85e961f

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