---
title: "clika_runtime.onnx functions"
sidebar_label: "Functions"
description: "Module-level functions of clika_runtime.onnx."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

## `load`

```python
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, keep_editable: 'bool' = False) -> 'Model'
```

load(path, *, dynamic_axes=None, specs=None, device=None, optimize=True, specialize=None, keep_editable=False) -> 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 optimizer and
finalizes the graph, so the model runs; ``specialize`` additionally
collapses the shape arithmetic the pinned shapes fix (None = the runtime
default, off), so it requires ``optimize``. ``optimize=False`` returns the
as-parsed graph, which runs after ``model.graph.finalize()``.
``keep_editable`` keeps the editable model as ``model.onnx`` for
:meth:`Model.recompile` after an edit; off (the default), the editable
model is released once the graph is built, so a large model's parsed
form does not stay resident beside the compiled one. A missing file
raises :class:`~clika_runtime.NotFoundError` (a ``FileNotFoundError``).
