Skip to main content

snnmetrics

This package provides metrics that are specific to spiking neural networks. The API is similar to the one of torchmetrics. Currently in beta phase.

Number of synaptic operations (SynOps)

  1. Define a SynOps metric for each spiking layer by providing the fanout as float (mostly used for Linear layers) or tensor with dimensions (C,H,W), mostly used for conv layers.
    import snnmetrics as sm
    synops_layer1 = sm.SynOps(fanout=10.)
    synops_layer2 = sm.SynOps(fanout=100.)
    
  2. Get activations of intermediate spiking layers either from model directly or through forward hooks.
    y_hat, (layer1_activations, layer2_activations) = model(x)
    
  3. Pass activations to synops metrics to compute batch statistics. Sum over time if necessary, allowed shapes are (B,C) or (B,C,H,W). Batch statistics will be averaged across the batch dimension so you'll likely end up with non-integer synops.
    batch_stats_layer1 = synops_layer1(layer1_activations)
    synops_per_neuron = batch_stats_layer1['synops_per_neuron']
    synops = batch_stats_layer1['synops']
    
  4. At the end of the epoch, compute the average synops across all mini-batches.
    epoch_stats = synops_layer1.compute()
    epoch_synops = epoch_stats['synops']
    
  5. Before the start of the next epoch, reset the metric.
    synops_layer1.reset()
    

Metadata

Release files for snnmetrics 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snnmetrics 0.0.1
File Size Uploaded Provenance
snnmetrics-0.0.1.tar.gz 7.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for snnmetrics 0.0.1
File Interpreter ABI Platform
snnmetrics-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / snnmetrics-0.0.1.tar.gz

Download URL snnmetrics-0.0.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
368b4dedf53d96499c7025272e673bb4aaed26d6f580359e1a5eac5280bd49d9
BLAKE2b-256 checksum
How to use checksums
9a415477ddb7ce996510072446f2999defa9069479cf38960f792300cdddc0f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / snnmetrics-0.0.1-py3-none-any.whl

Download URL snnmetrics-0.0.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b72b90d8b95e0bf9410972483c5405b0a5188d8347bf402eaf10646b18c3d0fc
BLAKE2b-256 checksum
How to use checksums
e2da62bed84bba4eba1e907df88a8eb20dff6118ff328b3649ee777d4741da8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for snnmetrics 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page