Skip to main content

clika_runtime.onnx functions

load​

load(path: 'str | os.PathLike[str]', *, dynamic_axes: 'DynamicAxes | None' = None, specs: 'Sequence[TensorSpec] | Mapping[str, Sequence[int]] | None' = None, device: 'Device | Stream | str | None' = None, optimize: 'bool' = True, specialize: 'bool | None' = None) -> 'Model'

load(path, *, dynamic_axes=None, specs=None, device=None, optimize=True, specialize=None) -> Model

Open an ONNX file, compile it and return a callable :class:Model.

dynamic_axes ({"X": {0: "batch"}}) names the axes that vary between calls; each must be dynamic in the model (a fixed axis is refused with the fix named). specs pins input shapes: a sequence of :class:TensorSpec or a mapping of input name to shape. device (a Device, a device string or a Stream) homes the weights and the outputs; None keeps them on the CPU. optimize runs the graph-optimization pipeline; specialize additionally bakes signature-static shape arithmetic (None = the runtime default, off). A missing file raises :class:~clika_runtime.NotFoundError (a FileNotFoundError).