IdentityEliminationPass¶
- class onnx_ir.passes.common.IdentityEliminationPass[source]¶
Pass for eliminating redundant Identity nodes.
This pass removes Identity nodes according to the following rules:
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.
If y is an output of a graph, and x is defined in that graph and is not a graph input, output, or initializer, we can eliminate the node and rename x to be y.
Otherwise, if y is a graph output, retain the node to preserve the existing names of graph inputs, outputs, and initializers.