onnx_light.onnx.inliner#

Inliner helpers for onnx_light.

onnx_light.onnx.inliner.inline_local_functions(model: Any, convert_version: bool = False) Any#

Inlines all model-local functions in the given model.

Returns:

A new ModelProto with all model-local functions inlined.

Raises:

checker.ValidationError – If the model contains cyclic function references.

onnx_light.onnx.inliner.inline_selected_functions(model: Any, functions: Sequence[tuple[str, str]], *, exclude: bool = False, inline_schema_functions: bool = False) Any#

Inlines the selected functions in the given model.

Parameters:
  • model – The model in which functions will be inlined.

  • functions – A sequence of (domain, name) pairs identifying the functions to inline (or to exclude when exclude is True).

  • exclude – When False (default), only the listed functions are inlined. When True, all functions except the listed ones are inlined.

  • inline_schema_functions – When True, schema-defined functions (e.g. Softsign) are also eligible for inlining in addition to model-local functions.

Returns:

A new ModelProto with the selected functions inlined.