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.1-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

talon_bridge-0.0.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

talon_bridge-0.0.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

talon_bridge-0.0.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

talon_bridge-0.0.1-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.1-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.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e2696e695c309072ef43b632173549dbe5d1d0a55b5d7c1ced791eb88a6241a5
MD5 71a47f3f5057f0b0a5ac2354baf794d7
BLAKE2b-256 63fc93feebf5cf9dbd66d37592363059e6319c42cc1b11aa307579e940079a53

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp313-cp313-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.1-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.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 00a61bff0ed3596b77acb88d25c42c90a593585a635e45cbec3a582be2aa17b9
MD5 a8b8e714d996b505f6f8b791687bc988
BLAKE2b-256 40bc43278061f981cc3a5ee2e9e8ae48f13e8ea335c9e27b9cfc12e6a7f1fcb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a042051a6aadd8f4e76a5a9e859c8825d1c4fd289dfce6c950422bb2983d7ef6
MD5 036c6918c4b1f3b45ea4d38ab627eba0
BLAKE2b-256 2eb4ec13be2599582a57f47c892144ccc36daef6ea3c7a4444e3a737851c1ce7

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4bf65765ed166e1bab5cf23774d3bb3db0ee63b2ca03b1ce31e86b027a9c082c
MD5 3a096d82cbee5a0d4a2d926e0dc3310e
BLAKE2b-256 41eeb9561679f1fa2a50f79bd13d516335ea4299662ad447627ea3fdf3a099c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3cbfc7b62bcfaa6f110a3d2adb9f63422c77999ba7f7873770fd744cbd463222
MD5 754944a558cb6c64dc8ca845e094c57e
BLAKE2b-256 db7433a0c64dbc173df3078309fc98845c568fe67b4c146e07b8093f3816a825

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.1-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.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 6c13ed0e2f214122dc536d8fc0ba28bf84b13a06937b83c41f8d68abdec5055c
MD5 418a850feecb6d70cd00c5ec2628868a
BLAKE2b-256 a4936048d581428b8391a20375e9423003a84c915493fa9b175465daff857297

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8d8924d845055b38512107b243baab621b6411c98ba1aa07649947cd5f81b792
MD5 4537fc239893cb6aeaa5083ed8cfae2c
BLAKE2b-256 c3dad71cbb71f7d10773474d106762dea7f3e9b55c538e3a9b702eb3443559c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61fe2b8ad2fdfed861e8fdcdcc9f33ab298cb71035603d5cbba9459a1761277a
MD5 6f86aa3c21b8303e62237cd2856e5e1e
BLAKE2b-256 a2ee594d6f205452413ad97191895c839bac473250fdd8285c253853b2664438

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c6f91caf6cb3272eeeb1f99209e889497c06bc54b1459692ff6fdf8127b2ad17
MD5 1f64d4b07626d5c451f27f2ce091deb4
BLAKE2b-256 2b05065747d5b711e39db859d6cf16afcebd88d77ec13ec0f313f1b0ee2b8026

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.1-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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 8616e5ac645d645a20b483ee61f816264d9fd0fe1d5f2fd8b0773c9f567c4037
MD5 aec5486220d192ff1aadefc1fbacfc7d
BLAKE2b-256 554b1258b844e04a939c59dbdfa17a83f3a3721cd62a120bc048cb69640720f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-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.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 62631bb9cd11b74233e41a2fc99ce098302b4ad43867067794587556d0dfaf7f
MD5 60039cbf2402fe3bffc34ce7b725620b
BLAKE2b-256 62c8a02cc3e57a97a117ac9c18365d0b476c08901ff70e786cefc57f0965429b

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8e308786333a68f649c0b8c4e0c7e01a5be6dc00997c86af18c1fcbb86ba4e8
MD5 577aeeac1e5ed1428a3117ab3cfdb261
BLAKE2b-256 bb0f62ef3081e54102797b304a65360a1076a1086ea1f4c86fb6a8c0f2c52f12

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 312375cc74ca2560e3029fd34c2f018a9b67bddb517a8f9aa26845ba4edfd572
MD5 1ef1ad3b09e6f7a67fa1bfbfdae58324
BLAKE2b-256 fc309910e8fc5dce9de95f8d5ce929c501ee2cb1476e87e1c38cb663b0ad07ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: talon_bridge-0.0.1-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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 d158c6661dfcb07f7751d2aa02f764bcd545692d99f0d5a3ae9ffb4b042c3cb7
MD5 0136f353f061d6919cad703898f9fde7
BLAKE2b-256 8a8ba65be6d78c9d5dd00f4dcd98847f511d822c847f085fd431311d1a4e7790

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-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.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 281c9be8a5b52bb887e4cf6854e247c79ceec1bdf787ba2b8ebea8e5dc7103e5
MD5 44102ce539c4f481d04c031ec568f716
BLAKE2b-256 cb80a9e0eb81e22be49750502c45511b56da4c5128f076bc092f6cf1af360aa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for talon_bridge-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c392ef7bca6bf750c941a2e83ddc14f234f489ed67768ba9e405e2670bb266cd
MD5 5cb6ff1459611e64e1db23f68fe4a53c
BLAKE2b-256 a66f86c4d9292e5c894310a91e95491cc2bcdb1ad254530a20b60f30552df7f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for talon_bridge-0.0.1-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