Metadata-Version: 2.4
Name: talon-viz
Version: 0.0.3
Summary: TALON Viz: Interactive visualizer for Talon IR graphs and spike data
Author-email: Anurag Daram <anurag@type1compute.com>, Subham Kumar Das <subham@type1compute.com>
Maintainer-email: Type 1 Compute <dev@type1compute.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/type1compute/talonviz
Project-URL: Documentation, https://type1compute.github.io/docs/talon-ecosystem/introduction
Project-URL: Repository, https://github.com/type1compute/talonviz.git
Project-URL: Issues, https://github.com/type1compute/talonviz/-/issues
Project-URL: Changelog, https://github.com/type1compute/talonviz/-/releases
Keywords: talon,neuromorphic,spiking-neural-networks,snn,visualization,intermediate-representation,dag,event-camera,machine-learning
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: talon-ir
Requires-Dist: rustworkx>=0.14.0
Requires-Dist: pillow>=9.0
Provides-Extra: tonic
Requires-Dist: tonic>=1.6.0; extra == "tonic"
Provides-Extra: all
Requires-Dist: tonic>=1.6.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
Requires-Dist: Cython>=3.0; extra == "dev"
Requires-Dist: inline-snapshot>=0.31.0; extra == "dev"
Provides-Extra: jupyter
Requires-Dist: ipython>=8.38.0; extra == "jupyter"
Dynamic: license-file

<!-- <div align="center" style="background-color: #08081e; width: 100%; padding: 0;">
  <img alt="TALON Logo" src="https://www.type1compute.com/images/t1c-logo-light.png" style="max-width: 200px; height: auto; display: block;">
</div> -->

<br>

# talon-viz - Interactive Visualization for TALON IR Graphs

<!-- [![GitLab Tag](https://img.shields.io/gitlab/v/tag/cvision-dev%2Ftype1compute%2Ft1cviz?logo=gitlab)](https://gitlab.com/cvision-dev/type1compute/t1cviz/-/tags) -->

talon-viz generates beautiful, interactive HTML visualizations of TALON IR computation graphs using D3.js and ELK for automatic layout. View your neural network architectures in Jupyter notebooks or export standalone HTML files.

talon-viz provides an intuitive way to explore and understand TALON IR computation graphs, making it easier to debug, analyze, and document neuromorphic neural network architectures.

> Read more about TALON IR in our [documentation](https://type1compute.github.io/docs/talon-ecosystem/introduction)

## Installation

```bash
uv add talon-viz@git+ssh://git@gitlab.com/cvision-dev/type1compute/t1cviz.git
```

Or with Jupyter support:

```bash
uv add "talon-viz[jupyter]@git+ssh://git@gitlab.com/cvision-dev/type1compute/t1cviz.git"
```

## Quick Start

```python
from talon import ir, viz

# Load a graph
graph = ir.read('model.t1c')

# Display interactively (opens browser or shows in Jupyter)
viz.visualize(graph, title="My SNN Model")
```

## Display Methods

### Browser Display

Outside Jupyter, opens in default browser:

```python
viz.visualize(graph, title="My SNN Model")
# Output: Visualization written to: /tmp/talon-viz/My_SNN_Model_xxx.html
```

### Jupyter Display

In Jupyter notebooks, displays as embedded iframe:

```python
viz.visualize(graph, title="My SNN", width=960, height=640)
```

### Export to File

Save as standalone HTML:

```python
path = viz.export_html(graph, "model.html", title="Production Model")
print(f"Saved to: {path}")
```

The HTML is self-contained - no server needed.

## Features

### Graph Visualization (Left Panel)

- **Dagre layout**: Automatic hierarchical graph layout
- **SNN-specific styling**: LIF neurons shown with distinctive spiking icon
- **Interactive**: Pan, zoom, click nodes to inspect
- **Parameter display**: Shows tau/theta on neuron nodes, kernel sizes on convolutions

### Data Explorer (Right Panel)

- **HDF5 tree**: Navigate graph structure
- **Array visualization**: Heatmaps for weights, line plots for biases
- **Statistics**: Min, max, mean, std for all arrays
- **Bidirectional sync**: Click in tree to highlight node in graph

## Node Colors

| Primitive | Color | Description |
|-----------|-------|-------------|
| Input | Green | Graph entry points |
| Output | Red | Graph exit points |
| Affine | Blue | Linear layers |
| SpikingAffine | Purple | Quantized affine with spike hints |
| LIF | Cyan | Leaky integrate-and-fire neurons |
| Conv2d | Orange | 2D convolution |
| SepConv2d | Deep Orange | Depthwise separable convolution |
| MaxPool2d | Brown | Max pooling |
| AvgPool2d | Blue Grey | Average pooling |
| Flatten | Grey | Reshape operations |
| Skip | Yellow | Residual/skip connections |

## Development

From the repo root (requires [talon-ir](https://github.com/type1compute/talonir) installed first):

```bash
uv pip install -e .
pytest tests/ -v
```
