.xbuilder._onnx_helper

experimental_experiment.xbuilder._onnx_helper.choose_consistent_domain_opset(domain: str, opsets: Dict[str, int] | None = None) int[source]

Chooses a compatible opset for a particular domain given this existing one. Only works for ai.onnx.ml, otherwise return 1.

Parameters:
  • domain – new domain

  • opsets – existing opsets

Returns:

version

experimental_experiment.xbuilder._onnx_helper.clean_shapes(proto: GraphProto | ModelProto)[source]

Cleans all shapes inplace.

experimental_experiment.xbuilder._onnx_helper.compatible_opsets(domain: str, op_type: str, current: int, new_version: int) bool[source]

Tells if two opset version for a particular operator type means the same version of it.

Parameters:
  • domain – domain, only ai.onnx and ai.onnx.ml are checked.

  • op_type – operator type

  • current – current domain version

  • new_version – new version

Returns:

result

experimental_experiment.xbuilder._onnx_helper.enumerate_subgraphs(node: NodeProto, recursive: bool = True) Iterator[Tuple[Tuple[NodeProto, str, GraphProto], ...]][source]

Returns the subgraphs inside a graph.

experimental_experiment.xbuilder._onnx_helper.same_function_proto(f1: FunctionProto, f2: FunctionProto, verbose: int = 0) str | bool[source]

Compares two functions and tells if they are equal.

Parameters:
  • f1 – first function

  • f2 – second function

  • verbose – to know why the comparison failed, the function returns a string in that case or True

Returns:

comparison

They may have different names.