Crate kn_graph

source ·
Expand description

A neural network inference graph intermediate representation, with surrounding utilities.

The core type of this crate is Graph, see its documentation for how to manually build and compose graphs.

An example demonstrating some of the features of this crate:

// load an onnx file
let graph = load_graph_from_onnx_path("test.onnx", false)?;

// optimize the graph
let graph = optimize_graph(&graph, Default::default());

// render the graph as an svg file
graph_to_svg("test.svg", &graph, false, false)?;

// execute the graph on the CPU
let batch_size = 8;
let inputs = [DTensor::F32(Tensor::zeros(IxDyn(&[batch_size, 16])))];
let outputs = cpu_eval_graph(&graph, batch_size, &inputs);

This crate is part of the Kyanite project, see its readme for more information.

Re-exports§

Modules§

Macros§