run_onnx_graph

Function run_onnx_graph 

Source
pub fn run_onnx_graph<B: Backend>(
    graph: &OnnxGraph,
    inputs: &HashMap<String, Tensor<B>>,
    device: &B::Device,
) -> Result<HashMap<String, Tensor<B>>>
Expand description

Execute an ONNX graph on the given backend.

Takes a parsed OnnxGraph and a map of input tensors. Initializer tensors from the graph are materialised on the given device. Each node is executed in order (the ONNX spec requires nodes in topological order).

Returns a map of output-name → Tensor for all graph outputs.

§Supported ops

Add, Sub, Mul, Div, MatMul, Gemm, Relu, Sigmoid, Tanh, Softmax, LogSoftmax, Reshape, Transpose, Flatten, Squeeze, Unsqueeze, Concat, Identity, Neg, Sqrt, Exp, Log, Abs, Clip, ReduceMean, ReduceSum, ReduceMax, ReduceMin, Gather, BatchNormalization, Dropout, Shape, Cast, Pow.

Unsupported ops produce an error.