IdentityEliminationPass¶

class onnx_ir.passes.common.IdentityEliminationPass[source]¶

Pass for eliminating redundant Identity nodes.

This pass removes Identity nodes according to the following rules:

  1. For any node of the form y = Identity(x), where y is not an output of any graph, replace all uses of y with a use of x, and remove the node.

  2. If y is an output of a graph, and x is not an input of any graph, we can still do the elimination, but the value x should be renamed to be y.

  3. If y is a graph-output and x is a graph-input, we cannot eliminate the node. It should be retained.

call(model)[source]¶

Main entry point for the identity elimination pass.

Parameters:

model (Model)

Return type:

PassResult