Spiking Attention Network model
Project description
sanet
Spiking Attention Network (sanet) model package.
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
Release history Release notifications | RSS feed
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.10.tar.gz
(111.8 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 sanet-1.0.10.tar.gz.
File metadata
- Download URL: sanet-1.0.10.tar.gz
- Upload date:
- Size: 111.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bc6d5d426b8f0486f5e025ae777e2ea8d6a05a7d2e186f62e16b87b2dee3f74
|
|
| MD5 |
f8d8871f1da5492d6f29352476b51b1e
|
|
| BLAKE2b-256 |
cc67e140593243961920cf441a98c23dc62b8cab9f6b718c60473eb44567e12b
|
File details
Details for the file sanet-1.0.10-py3-none-any.whl.
File metadata
- Download URL: sanet-1.0.10-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fef03297a6868ef85a625b958eff6926ad083c2daa268d3bd1a4483c267c5a19
|
|
| MD5 |
43c3ea4a5479de3554e5de9de9b7df13
|
|
| BLAKE2b-256 |
fd5bdd09c3252106032ae68a509584b2e3746f91b1085a0b525d13bdf247844d
|