Skip to main content

Neuromorphic Intermediate Representation Visualisation Tool

Turn your NIR definitions into a nice graph, the original publication serving as a template.

Customise your node colour preferences in style.yml, and quickly generate graphs from your neuromorphic networks.

This work is in progress.

Running Example (Jupyter Notebook)

By running the following code (from a notebook),

import nir
import nirviz
import numpy as np


a = np.random.randn(2)
ir = nir.NIRGraph(
    nodes={
        "input": nir.Input(input_type=np.array([2])),
        "affine1": nir.Affine(weight=np.zeros((2,2)), bias=False),
        "cu1": nir.CubaLIF(tau_mem=a, tau_syn=a, r=a, v_leak=a, v_threshold=a, v_reset=a),
        "affine_rec": nir.Affine(weight=np.zeros((2,2)), bias=False),
        "affine2": nir.Affine(weight=np.zeros((2,2)), bias=False),
        "cu2": nir.CubaLIF(tau_mem=a, tau_syn=a, r=a, v_leak=a, v_threshold=a, v_reset=a),
        "output": nir.Output(output_type=np.array([2]))
    },
    edges=[("input", "affine1"), ("affine1", "cu1"), ("affine_rec", "cu1"),  ("cu1", "affine_rec"), ("cu1", "affine2"), ("affine2", "cu2"), ("cu2", "output")])

viz = nirviz.visualize(ir)
viz.show()

You would get the following visualisation

nirviz output

Similar to Figure 3 of the publication.

Figure 3 of NIR paper for comparison to output

Running example (CLI)

To convert a saved NIR graph (e.g. srnn.nir) to a PNG or SVG, you can use one of the following commands:

python -m nirviz srnn.nir              # SVG -> stdout
python -m nirviz srnn.nir img/srnn.png # PNG -> file
python -m nirviz srnn.nir img/srnn.svg # SVG -> file

Developing with Nix

If you have Nix installed, flake.nix provides a reproducible dev environment (Python, graphviz, and the other dependencies) without needing a manually managed venv:

nix develop                 # Drop into pre-packaged shell.
python -m nirviz srnn.nir   # Example

You can also build or run the package directly, without entering a shell:

nix build .        # build the nirviz package into ./result
nix run . -- srnn.nir img/srnn.png

Customising the style

You can customise the style you see via the style file.

Style file location

The style file is defined in YAML. You can find the default location by running:

import nirviz
print(f"nirviz style file location: {nirviz.visualize.default_style_file()}")

or by passing your own style.yml:

import nirviz
viz = nirviz.visualize(nir_graph, style_file="style.yml")
viz.show()
python -m nirviz --yaml './style.yml' srnn.nir

Style file format

The format currently only supports setting node attributes. The node attributes correspond to Graphviz node attributes. An example file would contain:

node-categories:
    category-name: # User defined
        patterns: ["Affine", "IF"]
        attributes:
            # Corresponds to node attributes of graphviz
            # https://graphviz.org/docs/nodes/
            color: "red"
            style: "filled"
            shape: "box"

Which would paint all "Affine" and "IF" NIR nodes red.

Metadata

Release files for nirviz 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nirviz 0.1.5
File Size Uploaded Provenance Actions
nirviz-0.1.5.tar.gz 102.4 kB With provenance Details for nirviz-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nirviz 0.1.5
File Interpreter ABI Platform Actions
nirviz-0.1.5-py3-none-any.whl Python 3 none any Details for nirviz-0.1.5-py3-none-any.whl

Total release size: 109.9 kB

Release files / nirviz-0.1.5.tar.gz

Download URL nirviz-0.1.5.tar.gz
Size 102.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a55b8f549d0d54d8408ee0daeee691b8a3d14eb4ee114756e9f52a930ea5480e
BLAKE2b-256 checksum
How to use checksums
fa61a355943b32f0bf0c081702a3bd8b0c4beca7a0d30bd6377cbcc9fb1b468c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 3, 2026.

Transparency log

Release files / nirviz-0.1.5-py3-none-any.whl

Download URL nirviz-0.1.5-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1013d4a6b0accc4283c175423dbec47358ea735fe5a4931e978879e196e37b1
BLAKE2b-256 checksum
How to use checksums
36c0cd045b34421f9dee2589855b1460433cb03095e4061e18d86b6d370215bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 3, 2026.

Transparency log

Security for nirviz 0.1.5

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nirviz-0.1.5.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 Jul 3, 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.1.5 This release

2 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