Skip to main content
Thrindex — The open neuromorphic compute engine

The open neuromorphic compute engine.
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 toolkit for spiking neural networks (SNNs). You author a model, train it, compile it to a .thx file, and run that file on the behavioral simulator.

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 that seals the trained model into a .thx file.

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, Flatten. Dense(delay=k) holds the input k steps. The first Conv2d takes input_height and input_width.
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
Sealed artifact thx.compile writes a .thx file. The simulator runs dense, convolution, flatten, LIF, and dense delays.
Traces model.forward_recorded(x) returns the same spikes plus per-layer rasters and the pre-reset membrane
Datasets thrindex.datasets: SHD, N-MNIST, DVS Gesture, CIFAR10-DVS. Install with pip install "thrindex[datasets]"

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 LIF parameters: threshold, tau_mem, tau_syn, reset. Synaptic delay is snn.Dense(..., delay=k), not a LIF argument.


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

Templates, public docs, CI snippet tests, the conformance suite, and the energy benchmark harness are shipped. The SDK authors, compiles, and simulates.

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


License

Apache 2.0 — see LICENSE.

Metadata

Release files for thrindex 0.6.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.6.0
File Size Uploaded Provenance Actions
thrindex-0.6.0.tar.gz 92.9 kB With provenance Details for thrindex-0.6.0.tar.gz

Built distributions (wheels)

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

Total release size: 6.7 MB

Release files / thrindex-0.6.0.tar.gz

Download URL thrindex-0.6.0.tar.gz
Size 92.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8d5d2407bc087d65a5819d3255f8a153bebf5c491cbf1d2ade8606bb34aa0769
BLAKE2b-256 checksum
How to use checksums
72df82e1e9e987f87520627ac8cd0732d9e33651cdf019f88d3773e69afc458e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / thrindex-0.6.0-cp314-cp314-win_amd64.whl

Download URL thrindex-0.6.0-cp314-cp314-win_amd64.whl
Size 447.9 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
979b7cef1bd43d72721b7f3ce498840967f7e6db3a5fc12f6cc817e51a7cf673
BLAKE2b-256 checksum
How to use checksums
c35bfc1e28897266598e5ba6840381d1c542b25a61401f134a99eb20bbbe4932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 636.1 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6efd4505a33dfe8432fc1bb7fa62d6e0cc84d68a164d14a7b231be515765727c
BLAKE2b-256 checksum
How to use checksums
475a8c63500094995b947c62f97bbce16fb4606962c988dcf057429818aaf9e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp314-cp314-macosx_11_0_arm64.whl
Size 559.0 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b91a001914fef5513b3e862809536c2b889883957e772d2d85e2930bf9860d0c
BLAKE2b-256 checksum
How to use checksums
e1399ad32ebb0a0bb70c80d177d3a16df0293a68b86bdfd967d0cd02c99f1533
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / thrindex-0.6.0-cp313-cp313-win_amd64.whl

Download URL thrindex-0.6.0-cp313-cp313-win_amd64.whl
Size 447.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
371d5a68d2955dad32870c0612183dbf2bcbec6d7f67dca5e97feb94511043f8
BLAKE2b-256 checksum
How to use checksums
efbb0a71f80ca900cdb203c86f6c09b03daa2a1e07f99a4a3d9364597470dd1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 635.4 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4705f7436ecae85d3452cc49915f70794cdf6e6b297c72e8b135622abae0b81c
BLAKE2b-256 checksum
How to use checksums
5d515e9c2955718315c1848efab101e02f41b967a26d54dbb986b181aeecf919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
Size 558.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a12750c248b39f84393fdb9a02e50d61479a42d7718ea6b3832f77b5d03a66ea
BLAKE2b-256 checksum
How to use checksums
82aec8ecc469f5ebbe9f5ce430c80679d06bfab479ce230ee78292b3e3aeedc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / thrindex-0.6.0-cp312-cp312-win_amd64.whl

Download URL thrindex-0.6.0-cp312-cp312-win_amd64.whl
Size 447.3 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
7972cbc5e49ed5242273184319ab34079d38fb922e090df4fd78b808d37a3a62
BLAKE2b-256 checksum
How to use checksums
72cb09ab8cdcd7b5c45cf2ec85c5b5d73352bf378567395801a16bad82f71eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 635.7 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6eafee82b21a2e3eb3887bd85779b25a03321eae0d4d95c3abfa717de090087a
BLAKE2b-256 checksum
How to use checksums
18b7c588c28b468fe2b94f71fc80b7289181ee278398a7347edb8a7fabeaa94c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
Size 558.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dda7ec4a4b78bd83d56a5a7d105c3ac851e7180c699c4b70ce81bf1c0b30290a
BLAKE2b-256 checksum
How to use checksums
72cf95b12dcd2725568b8f6d021efcd41f7fed874350a79ea7d9141b3207d466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / thrindex-0.6.0-cp311-cp311-win_amd64.whl

Download URL thrindex-0.6.0-cp311-cp311-win_amd64.whl
Size 450.3 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
2f45b66729f32a8573383feeeb33c0ee2f6ea20d68bab537064a7be0d6e364aa
BLAKE2b-256 checksum
How to use checksums
317c173f8346e9eac39540cfd0d922be916ddadda5abc106600c39e29eea3240
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 639.0 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b7b22ea622d7e497f3f56d3b0373de8f239b980dc1f5d6d2a25dc1a1442f9d76
BLAKE2b-256 checksum
How to use checksums
8efc1d6c6ae76ecbba08ade5be8c14e511350097b3c7d76bb57180d51d55d9ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL thrindex-0.6.0-cp311-cp311-macosx_11_0_arm64.whl
Size 563.1 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
20e609a7808c234c0a42763dc448f7add7859558e85512e390498bfb7ac1329f
BLAKE2b-256 checksum
How to use checksums
f937d248c6ff19cbf1472d0c4216660b4647c0203bbd17a0499df17cf4617b07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Security for thrindex 0.6.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 13 files in this release have been uploaded with provenance metadata.

Select from 13 files

Attestation for thrindex-0.6.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 Oct 29, 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.6.0 This release

13 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