Skip to main content

TALON Bridge: PyTorch export, import, and runtime for Talon IR graphs

Project description


talon-bridge - PyTorch Bridge for TALON IR

PyTorch helpers for the TALON IR (Tactical AI at Low-power On-device Nodes Intermediate Representation). This package enables PyTorch-based libraries to translate models to and from TALON IR, providing export, import, and execution capabilities for neuromorphic neural networks.

talon-bridge serves as the bridge between PyTorch models and TALON IR graphs, enabling seamless model portability and deployment to TALON hardware.

Read more about TALON IR in our documentation

Installation

uv add talon-bridge@git+ssh://git@github.com:type1compute/talonbridge.git

Or with pip:

pip install talon-bridge

Usage

talon-bridge provides two main functions to_ir and ir_to_torch that map PyTorch models to TALON IR graphs and vice versa.

Translating from PyTorch to TALON IR

talon-bridge automatically traces through your PyTorch model and converts each module to the corresponding TALON IR primitive. You can provide custom converters for unsupported modules via the custom_map argument.

import torch
import torch.nn as nn
from talon import bridge, ir

# Define your model
model = nn.Sequential(
    nn.Linear(784, 128),
    nn.Linear(128, 10)
)

# Export to TALON IR
graph = bridge.to_ir(model, torch.randn(1, 784))

# Save to file
ir.write("model.t1c", graph)

For custom modules, provide a mapping dictionary:

# Define custom PyTorch -> TALON IR mapping
from talon import bridge, ir
custom_map = {}
def _extract_custom_module(module: MyCustomModule) -> ir.Node:
    # Convert your custom module to a TALON IR node
    return ir.Affine(weight=module.weight, bias=module.bias, ...)
custom_map[MyCustomModule] = _extract_custom_module

# Export with custom mapping
graph = bridge.to_ir(model, sample, custom_map=custom_map)

Translating from TALON IR to PyTorch

talon-bridge automatically creates PyTorch modules from TALON IR nodes. The ir_to_torch function combines import with execution, returning an executable GraphExecutor module.

from talon import bridge
import torch

# Load and create executable module
executor = bridge.ir_to_torch("model.t1c")

# Execute
output = executor(input_tensor)

For stateful models (SNNs), use return_state=True:

# Load with state management
executor = bridge.ir_to_torch("model.t1c", return_state=True)

# Execute with state
state = None
for t in range(100):
    output, state = executor(input_tensor, state)

You can also provide custom node converters:

from talon import bridge, ir
def custom_node_map(node: ir.Node) -> Optional[torch.nn.Module]:
    if isinstance(node, MyCustomNode):
        return MyCustomModule(...)
    return None  # Falls back to default converter

executor = bridge.ir_to_torch(graph, node_map=custom_node_map)

Quick Start

Basic Export and Execute

import torch
import torch.nn as nn
from talon import bridge, ir

# Your model
model = nn.Sequential(nn.Linear(784, 128), nn.Linear(128, 10))
sample = torch.randn(1, 784)

# Export to TALON IR
graph = bridge.to_ir(model, sample)

# Save to file
ir.write("model.t1c", graph)

# Load and execute
executor = bridge.ir_to_torch("model.t1c")
output = executor(sample)

Spiking Neural Network

import torch
import torch.nn as nn
import snntorch as snn
from talon import bridge

# Define SNN
model = nn.Sequential(
    nn.Linear(784, 128),
    snn.Leaky(beta=0.9, init_hidden=True, output=True),
    nn.Linear(128, 10),
    snn.Leaky(beta=0.9, init_hidden=True, output=True),
)

# Export
graph = bridge.to_ir(model, torch.randn(1, 784))

# Execute with state
executor = bridge.ir_to_torch(graph, return_state=True)
state = None
for t in range(100):
    output, state = executor(input_tensor, state)

Supported Modules

talon-bridge automatically converts the following PyTorch modules to TALON IR:

PyTorch Module TALON IR Node Notes
nn.Linear Affine or SpikingAffine Use spiking=True for hardware-optimized version
nn.Conv2d Conv2d Full 2D convolution support
nn.Flatten Flatten Tensor flattening
nn.MaxPool2d MaxPool2d 2D max pooling
nn.Identity Skip Skip/residual connections
snn.Leaky LIF snnTorch LIF neuron

For Hardware Teams

talon-bridge is for validation only. The execution runtime is a PyTorch simulation of what the hardware will do. Use it to verify your IR graph produces correct outputs before deploying to actual hardware.

The GraphExecutor handles:

  • Topological sorting of graph nodes
  • State management for stateful modules (LIF neurons)
  • Skip connections and residual paths
  • Multiple input/output handling

Development

From the repo root, install in editable mode (requires talon-ir installed first):

uv pip install -e .
# or: pip install -e .
pytest tests/ -v

If you see AttributeError: module 'talon.bridge' has no attribute 'to_ir', you are likely using an old install. Uninstall any legacy package and reinstall in editable mode:

pip uninstall talon-bridge 2>/dev/null; uv pip install -e .

Documentation

For more information, visit the TALON IR documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

talon_bridge-0.0.2-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

talon_bridge-0.0.2-cp313-cp313-win32.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86

talon_bridge-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

talon_bridge-0.0.2-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

talon_bridge-0.0.2-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

talon_bridge-0.0.2-cp312-cp312-win32.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86

talon_bridge-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

talon_bridge-0.0.2-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

talon_bridge-0.0.2-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

talon_bridge-0.0.2-cp311-cp311-win32.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86

talon_bridge-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

talon_bridge-0.0.2-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

talon_bridge-0.0.2-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

talon_bridge-0.0.2-cp310-cp310-win32.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86

talon_bridge-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

talon_bridge-0.0.2-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file talon_bridge-0.0.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 adc84d0e869ed9c55af9eb864ab79ae250ca09785d95cc7731e3b0682ce55f66
MD5 e5daa83afb450bc84715499fef82a444
BLAKE2b-256 faac65d40c77158f810fff4b4930f68dbcfe99999f243cd8ff9048e75e2abeb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp313-cp313-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for talon_bridge-0.0.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 349cf405a09927258394ff9f9aec6f76ed62a458c0da0fe617af53c0e8b7acc5
MD5 95080cf8f13ed674a47692c1f3d64fbd
BLAKE2b-256 59bff2f4922d59f5dbcf6987b497451cbfa09107b5cad4c916caaa460ad08e26

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp313-cp313-win32.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c5f772eca7863eb44fa1520f5a8145c50cb451086625b885426aad7b737308d1
MD5 d886a1ff0ecf30a346071bcfcddfac7e
BLAKE2b-256 ba16660969eb8b5d7acd653e22c8215e907bc1288f48cdda9686d03321ee5836

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a33008d65c10cbaf785c98bc133468b3b34bab1035b707b0742d1f541921a833
MD5 7d09f92c1246d7e5fab06fdde7d1a9ca
BLAKE2b-256 7e88f7ef2d053a047a381576d6770bdea07f4de9787f58d007e7383f2a7d30a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 32cb5c69c6bd3be828e4589d080b7d1ebb86117e51f1d6b87a10f981ede29c32
MD5 2cba6bd2286147a5c96c4c78846dd9c6
BLAKE2b-256 5a0bbc3128eb65e2f1e1a52c24fe56d7c75fe45d03254601c361a6955d54178f

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp312-cp312-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for talon_bridge-0.0.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 c3bfcf4f714e80a9de975c847f662170d7ff1338293c2c12f899cfaae48ff309
MD5 3bfc18c280814cce21408f1335640868
BLAKE2b-256 ab7f94a7e9711bc5605e87fd8e80dbf7ff1e3941bb3aa9d6f4a05ad44e061e0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp312-cp312-win32.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80344f0cd3472b6e453948348247acc90f1b1e4dd1b9c0b40033b5d5e2d82fd9
MD5 926b2a5e5a51a5b9f5e348b8ef03bc12
BLAKE2b-256 a6bf30612b167e05c2db8ddf8df4eb3515f296209ae84e8e568cddd33c358da9

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41c9e32a9cbf412f74171f7cd952a193d8d1a08ece699eead3e22206d7366fac
MD5 7a6b026928a30615bff8d38fd6f7c3c0
BLAKE2b-256 076bb4888aceb9955fdde050c16122af3616a482c11be971f7db7ac109243b69

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f542d6b37b361b4bb43e23b63e3f810755f259d57bb860fb009d116f9ffbf50a
MD5 c91161958d54dfd86efb4c7515309d4f
BLAKE2b-256 c585cea0038e256a3dd870ee197d881a03c643b0e992069fd1365ef3bb212d73

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp311-cp311-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for talon_bridge-0.0.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 6d50c4a32bc89581cc5c64893a6e4142e91497a2ce91e6a9e59760492111447c
MD5 34872714256cac4348753dcd21bdc6ac
BLAKE2b-256 571910cfbeefff18080f534ce5e91e383e35d435de224ea09c962f600fd2daea

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp311-cp311-win32.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 edbd94609b6cfc72eb175dd34b9b4477e5897d529e902720c1bb1afddc4093b1
MD5 c70079bd66af7f26d1c2baa4e4de3648
BLAKE2b-256 5cd7f52c2774f386dc29a0325f75946779a1585dfee3839662797591b05904cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dcfce3e5b670006d279fa9071281eca3fb334c1ceb2a5654ca0ec245c756a28b
MD5 4fc2a797e798effeba42086415d30b5b
BLAKE2b-256 c63e0d47910482c0a9d7cf94876dd4983dc09aa07a1865a09c5f50caca8ca1cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 56eea4f4c650bb786c3568e6cba46a53d79dea619fe46fbc1fb7bda5879b3491
MD5 265c699311b5416e3213bf0fa92a4424
BLAKE2b-256 638c5489dc59e41e85467c370f66cba78540d8edd73d4c087636cbdea6d700d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp310-cp310-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for talon_bridge-0.0.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 fdf24819062872888c7528cb3870ff75b25f548e9e7eea6738e102b3af578999
MD5 0418e0cb0f56bdbdfe4bdd2558c831a1
BLAKE2b-256 dfce044a108bb2b6f8061efb54c44a9535d6c54498c62f24f9cbddec0221b1c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp310-cp310-win32.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23732ebdbeed2458494d2b38eb6ff936ba8b09b1a4a0d2afec43a827e6cbf219
MD5 fa3daabbf4f8e6f397a14d45da305b58
BLAKE2b-256 dbcef3b58f4c6ec268c04680d420db642b29a65bdd921d878e77ef1d67bb0b58

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file talon_bridge-0.0.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56f175305190a4e2a42d328e794ff654434ddcd64c6de430eecc65cfe883964a
MD5 7906dc4378101bddc8626920c5f8c153
BLAKE2b-256 6f3c959921020783f4443aaa8edf2154c2ba9c7599cde0c2a6b6c7d072c7b95a

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.2-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on type1compute/talonbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page