InlinePass¶

class onnx_ir.passes.common.InlinePass(criteria=None)[source]¶

Inline model local functions to the main graph and functions and remove unused functions.

When a node calls a function defined in the model and when criteria is None or criteria(function) returns True, the function body is inlined into the graph in place of the call node.

Added in version 0.1.16: The criteria parameter.

Requires:

No cyclic dependencies between functions in the model.

Parameters:

criteria (Callable[[ir.Function], bool] | None)

criteria¶

Optional function that takes an onnx_ir.Function and returns True if the it should be inlined. If None, all function calls are inlined.

requires(model)[source]¶

Pre-conditions for the pass.

This is optional to implement, will be called before call() if run by a pass manager.

Parameters:

model (Model)

Return type:

None

call(model)[source]¶

The main entry point for the pass.

Parameters:

model (Model)

Return type:

InlinePassResult