Skip to main content

clika_runtime.onnx

Load an ONNX model as a callable in one call.

::

import clika_runtime as crt

model = crt.onnx.load("mlp.onnx", device="cuda:0")
outputs = model(X=crt.tensor(x)) # dict, output name -> Tensor
y = outputs["Y"]

:func:load opens the file, compiles it, optimizes and finalizes the graph, and returns a :class:Model: call it with the inputs by name (or positionally in input_names order) and read the outputs by name. The compiled form is model.graph. The editable form (an :class:~clika_runtime.io.OnnxModel) is released once the graph is built, and the parsed model's share of memory goes with it, which on a small board is the difference between a model that fits and one that does not, unless keep_editable=True keeps it as model.onnx for :meth:Model.recompile after an edit.

NameKind
Modelclass
functionsmodule functions