Skip to content
rustnn logo

rustnn

rustnn is a Rust implementation of the W3C WebNN API. It records neural network graphs with a WebNN-style builder, validates and shape-infers them, and executes them on a pluggable backend.

Experimental. rustnn is a development release. APIs change without notice and the crate is not meant for production use. This site documents the main branch; the rustnn crate on crates.io (0.6.0 and later) carries the same MLContext API, while the 0.5.x releases were the earlier converter and loader crate.

Start with Getting Started for installation, then the crate's runnable example. The Rust API reference is generated from source comments. It owns signatures, option defaults, backend selection and environment variables. These guide pages cover workflows and link to those contracts.

For C and C++, see the usage guide and generated API reference.

Backend support is tracked in the generated operator report and WPT dashboard. See the WPT guide for which backends and environments the harness exercises.

Documentation map

Section Content
Getting Started Requirements, adding the crate, first graph, loading .webnn files, the CLI
Examples The example programs in examples/ and short recipes
Troubleshooting Error messages by phase, their causes and fixes
API and Support Map Pointers to API contracts, unimplemented methods, backend support, and consolidated guides
Rust API Reference Generated rustdoc for every public item, deployed from main; locally make docs-api writes it to target/doc/rustnn/
Architecture Layers, data flow, module map and design decisions
Development Toolchain, build and test commands, adding operations and backends, CI
Converter Internals The converter contract, backend-specific lowering rules, debugging emitted models
Documentation Policy What to update when code changes; rules for contributors and coding agents
Backend Operator Support Generated operation-by-backend matrix
WPT Conformance Guide Running and triaging the Web Platform Tests
TensorRT-RTX The native TensorRT backend, caching and precision
CoreML, LiteRT, CANN, Browser WebNN Requirements, device mapping, testing and limits per backend
Graph Files and Weights Shared loader guide: source graphs, external weights, and links to format contracts

Python

Python bindings live in the separate pywebnn package, which uses rustnn as its core library. This repository contains no Python API.

Support