Skip to content

Getting Started

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

Getting Started

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

Install

Default branch on GitHub is often Main (capital M); use your remote’s actual default:

[dependencies]
nir-rs = { git = "https://github.com/Limen-Neural/nir-rs", branch = "main" }

# With HDF5 .nir I/O (links libhdf5):
# nir-rs = { git = "...", features = ["hdf5"] }

System dependency (hdf5 feature)

Platform Package
Ubuntu/Debian apt install libhdf5-dev
macOS brew install hdf5
Hermetic depend on hdf5-metno with features = ["static", "zlib"] so unification applies

Build a graph (no HDF5)

use nir_rs::nodes::{Input, Output};
use nir_rs::{NirGraph, NirNode};

fn main() -> nir_rs::Result<()> {
    let mut g = NirGraph::new();
    g.insert_node("input", NirNode::Input(Input {
        shape: vec![4],
        metadata: Default::default(),
    }))?;
    g.insert_node("output", NirNode::Output(Output {
        shape: vec![4],
        metadata: Default::default(),
    }))?;
    g.add_edge("input", "output");
    g.validate_structure()?;
    Ok(())
}

Read / write .nir

// requires features = ["hdf5"]
let graph = nir_rs::io::read("model.nir")?;
nir_rs::io::write("copy.nir", &graph)?;

Without the feature, io::read / write still exist and return NirError::Unimplemented.

Develop

cargo fmt --check
cargo test
cargo test --all-features
cargo clippy --all-targets --all-features -- -D warnings
cargo doc --no-deps --all-features

No Python in build, tests, or CI — fixtures are vendored binary .nir files.

Next


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: df72fc9 (main)

Clone this wiki locally