onnx.inliner

inline_local_functions

onnx.inliner.inline_local_functions(model: ModelProto, convert_version: bool = False) ModelProto[source]

Inline model-local functions in given model.

Parameters:
  • model – an ONNX ModelProto

  • convert_version – if true, try to apply automatic version-conversion to functions requiring a different (ONNX) opset version from the model.

Returns:

ModelProto with all calls to model-local functions inlined (recursively)

inline_selected_functions

onnx.inliner.inline_selected_functions(model: ModelProto, function_ids: list[tuple[str, str]], exclude: bool = False) ModelProto[source]

Inline selected model-local functions in given model.

Parameters:
  • model – an ONNX ModelProto

  • function_ids – list of functions to include/exclude when inlining. Each element is a tuple of (function domain, function name).

  • exclude – if true, inlines all functions except those specified in function_ids. if false, inlines all functions specified in function_ids.

Returns:

ModelProto with all calls to model-local functions inlined (recursively)