CommonSubexpressionEliminationPass¶

class onnx_ir.passes.common.CommonSubexpressionEliminationPass(size_limit=10)[source]¶

Eliminate common subexpression in ONNX graphs.

Added in version 0.1.1.

Changed in version 0.1.3: Constant nodes with values smaller than size_limit will be CSE’d.

Parameters:

size_limit (int)

size_limit¶

The maximum size of the tensor to be csed. If the tensor contains number of elements larger than size_limit, it will not be cse’d. Default is 10.

call(model)[source]¶

Return the same ir.Model but with CSE applied to the graph.

Parameters:

model (Model)

Return type:

PassResult