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.4.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.4.0
File Size Uploaded Provenance Actions
thrindex-0.4.0.tar.gz 65.1 kB With provenance Details for thrindex-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for thrindex 0.4.0
File Actions
thrindex-0.4.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.4.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.4.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for thrindex-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
thrindex-0.4.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.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.4.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for thrindex-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
thrindex-0.4.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.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.4.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for thrindex-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
thrindex-0.4.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.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thrindex-0.4.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for thrindex-0.4.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 4.4 MB

Release files / thrindex-0.4.0.tar.gz

Download URL thrindex-0.4.0.tar.gz
Size 65.1 kB
Tags Source
SHA-256 checksum
How to use checksums
72b92027a633ee5d7dd594d32512eb890e76c709ba9a01653830f60aa53e5084
BLAKE2b-256 checksum
How to use checksums
9344b879b51247f4b6ff454a40204cbe55c994b6ca0565979bd111b6a91eb3e6
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 569.0 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b5656b35412477931a68b3ed5b1f051c82c126e5d53575b1d076ed5dc8dc59ca
BLAKE2b-256 checksum
How to use checksums
0b0bf0356ec30358b0dac911a71519903460e674352f313f4de6959bc25e43f3
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
Size 502.9 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4011a3e02dc20aee71c0381472b4d6603f59c0c67e60074ac435e761aa418516
BLAKE2b-256 checksum
How to use checksums
694d36c6663275d01f4190e6b2aac85e530b4b6a92590407de2f8b334149fc27
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 568.5 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b334d4e2683fb3ec5769ecbc5dffbb67297c22ecc00f0f45d1afa5eeeefbccd3
BLAKE2b-256 checksum
How to use checksums
278405a7b4bca89bb134919b5d6a1599103b9e4a0eb9298e1d4066cd7b11ea4a
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Size 502.8 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ac00521495883288b7338ad1b0402758b1e3c077e4b5c044e5d5c4985eb47e5b
BLAKE2b-256 checksum
How to use checksums
4d892b4ef1569a75690f3733428a350239cef3969cde1e6cad1d2b318d8f5bff
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 568.4 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a9b918b78df839324496d6a6e6bf461e2a9050ba4920888d68026153ddcec2c0
BLAKE2b-256 checksum
How to use checksums
fc9840b1fdeefe7a6b79841775f57cb93ef341b4518a9bbcdeff53e115c69a69
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Size 502.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b8e599f8d273502304736c81380ad8d504cacb0982e9dd79e2605e79e77dab9f
BLAKE2b-256 checksum
How to use checksums
fea5ff6083e24544554fdbbf0ba525f11f90734ed2d83e31d0f0abb9b7c4ffe9
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 570.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
69982ff96b4d9f71787648a86ae83c3e92f1230838f6d26e642c359432685dd1
BLAKE2b-256 checksum
How to use checksums
b5589b5c1cd57116e4acec84469c0c50614005424f59897de5162cc7c444af13
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 8, 2026.

Transparency log

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

Download URL thrindex-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Size 506.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bc20a0067779cbd9187ffbe099a71aadefcecfaf099f5ad398d7c6cc68f8f71d
BLAKE2b-256 checksum
How to use checksums
540218fbdb29660d3b57c9243041cebf385beb31da5ba17100f33073a41a3b42
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 8, 2026.

Transparency log

Security for thrindex 0.4.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.4.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 8, 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.4.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