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§

pub use ndarray;

Modules§

cpu
CPU graph execution.
dot
Graph visualization as a dot or svg file.
dtype
The DType enum.
graph
The core graph datastructure.
onnx
Onnx file loading.
optimizer
Graph optimization.
shape
The Shape type and utilities.
visualize
Hidden activations visualization.
wrap_debug

Macros§

dispatch_dtensor
dispatch_dtensor_pair
dispatch_dtype
map_dscalar_pair
map_dtensor
map_dtensor_pair
shape