Skip to main content

OnnxModel

ir_version (property)

(self) -> int

num_initializers (property)

(self) -> int

num_nodes (property)

(self) -> int

opset (property)

(self) -> int

__init__

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

add_initializer

add_initializeradd_initializer(self, value: clika_runtime._core.Tensor) -> str

add_initializer(self, value: clika_runtime._core.Tensor) -> str

Create a graph constant from a tensor's bytes; returns the generated initializer name.

add_input

add_inputadd_input(self, name: str, dtype: clika_runtime._core.DataType, shape: collections.abc.Sequence[int]) -> str

add_input(self, name: str, dtype: clika_runtime._core.DataType, shape: collections.abc.Sequence[int]) -> str

Register a graph input; any dim <= 0 declares a dynamic dimension. Returns the tensor name.

add_node

add_nodeadd_node(self, op_type: str, inputs: collections.abc.Sequence[str], num_outputs: int = 1, attrs: dict = {}, domain: str = '', output_names: collections.abc.Sequence[str] = []) -> list[str]

add_node(self, op_type: str, inputs: collections.abc.Sequence[str], num_outputs: int = 1, attrs: dict = {}, domain: str = '', output_names: collections.abc.Sequence[str] = []) -> list[str]

Append a node: positional input tensor names in, generated (or caller-named) output names back. Attributes ride a dict of int / float / str / list values.

add_output

add_outputadd_output(self, name: str, dtype: clika_runtime._core.DataType, shape: collections.abc.Sequence[int]) -> str

add_output(self, name: str, dtype: clika_runtime._core.DataType, shape: collections.abc.Sequence[int]) -> str

Register a graph output. Returns the tensor name.

compile

compilecompile(self) -> clika_runtime._core.io.ModelGraph

compile(self) -> clika_runtime._core.io.ModelGraph

Build the executable form: every node parses into its runtime operator (an unsupported op fails here, naming it), weights bind, shapes resolve. Returns the runnable ModelGraph; the OnnxModel is unchanged and reusable.

create

create(*args, **kwargs)

create(graph_name: str, opset_version: int = 0) -> clika_runtime._core.io.OnnxModel

Create an empty model at the given ai.onnx opset (0 = the library default); build it up with add_input / add_initializer / add_node / add_output.

inputs

inputsinputs(self) -> list

inputs(self) -> list

Graph inputs as (name, DataType, dims) tuples; a dynamic dim reads as -1.

open

open(*args, **kwargs)

open(path: str) -> clika_runtime._core.io.OnnxModel

Open a .onnx file (initializer payloads referenced as external data stay on disk beside it).

optimize

optimizeoptimize(self) -> int

optimize(self) -> int

Run the graph-rewrite pipeline to a fixed point; returns the pass count.

outputs

outputsoutputs(self) -> list

outputs(self) -> list

Graph outputs as (name, DataType, dims) tuples.

remove_node

remove_noderemove_node(self, name: str) -> None

remove_node(self, name: str) -> None

Remove the node named name (an error if absent).

save

savesave(self, path: str) -> None

save(self, path: str) -> None

Assemble the model and write it to path.