onnx_light.onnx.version_converter#

exception onnx_light.onnx.version_converter.ConvertError#
onnx_light.onnx.version_converter.convert_version(model: ModelProto, target_version: int) → ModelProto#

Converts the model to the given target opset version.

Retains local functions and converts their bodies from their own default-domain opset imports. Preserves references to function attributes.

Parameters:
  • model – The input ModelProto to convert.

  • target_version – The target opset version for the ai.onnx domain.

Returns:

A new ModelProto converted to the target opset version.

Raises:
  • ConvertError – If the conversion cannot be completed, including when any graph contains unsupported sparse initializers.

  • RuntimeError – If an adapter requires a concrete value for an unresolved function attribute or unavailable type or shape information.