Skip to main content
Thrindex — The open compiler for spiking neuromorphic compute

The open compiler for spiking neuromorphic compute.
Author spiking neural networks in Python. Compile them to neuromorphic hardware.


Website · Docs · Discussions



CI PyPI Downloads License: Apache 2.0 Python 3.11+


What is it?

thrindex is the full-stack toolkit for spiking neural networks (SNNs) — from model authoring to deployment on neuromorphic hardware.

It gives you a PyTorch-native authoring API for building and training SNNs with surrogate gradients, a deterministic Rust simulation engine for fast, reproducible model validation, and a compiler + runtime that targets real neuromorphic chips — all through one unified SDK.

import thrindex as thx
import thrindex.snn as snn

model = snn.Sequential(
    snn.Dense(784, 1000),
    snn.LIF(threshold=1.0, tau_mem=5.0),
    snn.Dense(1000, 10),
    snn.LIF(threshold=1.0, tau_mem=5.0),
)

# train with surrogate gradients — standard PyTorch loop
loss = thx.train.rate_loss(model(encoded_input), labels)
loss.backward()

Install

pip install thrindex

Requires Python 3.11+ and PyTorch 2.0+.


Quickstart

import torch
import thrindex as thx
import thrindex.snn as snn
from thrindex.encoders import rate
from thrindex.train import rate_loss

# Build a two-layer LIF network
model = snn.Sequential(
    snn.Dense(784, 1000),
    snn.LIF(threshold=1.0, tau_mem=5.0, reset="subtract"),
    snn.Dense(1000, 10),
    snn.LIF(threshold=1.0, tau_mem=5.0, reset="subtract"),
)

# Rate-encode your input (explicit generator — no global RNG state)
gen = torch.Generator()
gen.manual_seed(42)
spikes = rate(x_batch, T=25, generator=gen)   # [T, batch, 784]

# Forward + loss
spk_out = model(spikes)                        # [T, batch, 10]
loss = rate_loss(spk_out, labels)

# Standard PyTorch backward
loss.backward()
optimizer.step()

Key features

Feature Detail
SNN layers LIF, Sequential, Dense, Conv2d — all nn.Module subclasses
Surrogate gradients Fast-sigmoid, analytically verified backward pass
Spike encoders Rate (Bernoulli), latency (time-to-first-spike), delta (change coding)
Deterministic numerics Parameterizable fixed-point Q<INT, FRAC> types; round-half-even; bit-identical across platforms
Typed errors Stable E#### error codes — every error tells you what happened, why, and how to fix it
Hardware target Compile .thx artifacts and deploy to neuromorphic silicon (M2+)

LIF neuron

The LIF module follows the exact per-timestep update order:

(i)   mem_t    = α · mem_prev + x_t          # leak + integrate
(ii)  spk_t    = H(mem_t − threshold)         # fire  (Heaviside; surrogate in backward)
(iii) mem_out  = mem_t − spk_t · threshold   # reset (subtract mode)

where α = exp(−dt / τ_mem) (exact exponential discretization, dt = 1 ms).

Canonical parameters: threshold, tau_mem, tau_syn, reset, delay.


Encoders

from thrindex.encoders import rate, latency, delta

# Rate: Bernoulli-sample — always pass an explicit generator
gen = torch.Generator(); gen.manual_seed(0)
spikes = rate(x, T=25, generator=gen)          # [T, *x.shape]

# Latency: higher value spikes earlier — deterministic, no RNG
spikes = latency(x, T=25)

# Delta: fires on change above threshold — deterministic, no RNG
spikes = delta(x_sequence, T=25, threshold=0.1)

Stack

python/thrindex/       Python SDK — strictly typed, zero logic
crates/thrindex-py/    PyO3 bridge (maturin)
crates/thrindex-sim/   Behavioral simulator — deterministic, seeded, CPU-parallel  (M2)
crates/thrindex-compiler/  Compiler: capture → validate → quantize              (M3)
crates/thrindex-numerics/  Fixed-point core — zero dependencies, consumed bit-for-bit

Rust engines are MIT/Apache-2.0. The Python SDK wraps them with no logic of its own.


Status

M5 complete — templates, public docs, CI snippet tests, conformance suite, and energy benchmark harness are all shipped. M6 (first silicon bring-up) is next.

Issues and discussions are open.
See SECURITY.md for responsible disclosure.


License

Apache 2.0 — see LICENSE.

Metadata

Release files for thrindex 0.5.0

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

Source distribution (sdist)

Source distribution for thrindex 0.5.0
File Size Uploaded Provenance Actions
thrindex-0.5.0.tar.gz 68.0 kB With provenance Details for thrindex-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for thrindex 0.5.0
File Actions
thrindex-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details for thrindex-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.5.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for thrindex-0.5.0-cp314-cp314-macosx_11_0_arm64.whl
thrindex-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for thrindex-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.5.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for thrindex-0.5.0-cp313-cp313-macosx_11_0_arm64.whl
thrindex-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for thrindex-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.5.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for thrindex-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
thrindex-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for thrindex-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.5.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for thrindex-0.5.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 4.4 MB

Release files / thrindex-0.5.0.tar.gz

Download URL thrindex-0.5.0.tar.gz
Size 68.0 kB
Tags Source
SHA-256 checksum
How to use checksums
23ed1c1f3c02a1df34189b99d0958d6478021e8d365efb6a63ab13fd457cad40
BLAKE2b-256 checksum
How to use checksums
df1582d7d7afe489d685bc645eae3239fd03b40871610da2f407d630cb2fb047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL thrindex-0.5.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 576.7 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
59da6ec1fff59b849ddd1bbdc79cfa67f293973f2787fe36a85ae70b7171c1e9
BLAKE2b-256 checksum
How to use checksums
af1b1f730b7c93e49b504285d9c8a31e6a6f77eeaf14fb1310cc307975d9ca6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL thrindex-0.5.0-cp314-cp314-macosx_11_0_arm64.whl
Size 509.7 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0a6614e14b1ae0f7a5cb23cc2aabce58612ffbbaa35f270a377dee563f68a84
BLAKE2b-256 checksum
How to use checksums
27dc8c2355fb593583b2ea4d0bec978a24326b96eb719657db334ee7cbc0c2c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL thrindex-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 575.9 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d7d00fbc7ee4a76f85f8ab5b0a5101e213fd8b23d490519e7060d287e008b767
BLAKE2b-256 checksum
How to use checksums
ff55ed8c06dfff35cf48b2d4cb744d2fe40a19848508e6782c0778af49cabcb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL thrindex-0.5.0-cp313-cp313-macosx_11_0_arm64.whl
Size 509.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ea6eae14c88ddf5fcd14d6a32cc406d3776056e9c411f5ea5ef10a3da6d35c50
BLAKE2b-256 checksum
How to use checksums
fe8724edae90d0132128a7915e892164e851b58a40027add0c1262f86ce02f58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL thrindex-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 576.0 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
dd9de8aca64ba07097ad07c40a29d9187e72aaed9099bdb4d5153f602c20f827
BLAKE2b-256 checksum
How to use checksums
a64539a9d6e24337aa5de849261ff2c4c7cd85c72af98889d1ad80e281d4fa73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL thrindex-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Size 509.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ba440d9d8eb394a1f69a877cf032855b629e1f2c40586ebcb17d89b9936274bb
BLAKE2b-256 checksum
How to use checksums
29dc8224e0f9fda384aa07d786e79427356b13e75ff585e90093e417e5661a02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL thrindex-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 579.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ecd696dfef8c03d0b679a1ffabcff2ef6a66400b1321f3251231fcd56918453d
BLAKE2b-256 checksum
How to use checksums
7229414b0a5664059b407e4fc254349eed9d777c3d4728722dcccf8ac0c72dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thrindex-0.5.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL thrindex-0.5.0-cp311-cp311-macosx_11_0_arm64.whl
Size 513.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
11de592aba88e3f45a0c9d04568745c0053f5fdf2d9d7950db4e39cf2ee4d1b3
BLAKE2b-256 checksum
How to use checksums
24ebf98b228b2bac6b291f8e13ada8f950e8962cc58a513e7a20394f121d3011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Security for thrindex 0.5.0

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.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for thrindex-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

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.5.0 This release

9 release files Full 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