Skip to content

Commit 086bb45

Browse files
committed
Add support for Conv-Act-Pool fusion
Signed-off-by: gcunhase <[email protected]>
1 parent 8c6b915 commit 086bb45

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modelopt/onnx/quantization/partitioning.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ def _build_fusible_partition(
4545
4646
Add a nodes to the partition if any of these holds:
4747
1. The node is a unary or binary pointwise operation and fusible by cask
48-
2. The node is BN and/or Relu and fusible with preceding Conv op
49-
3. The node is a residual Add and fusible with current partition
48+
2. The node is BN and/or Relu and fusible with preceding Conv op (Conv-Act fusion)
49+
3. The node is MaxPool following a Conv-Act pattern (Conv-Act-Pool fusion)
50+
4. The node is a residual Add and fusible with current partition
5051
5152
Args:
5253
cur_node: Current candidate node for the partition.
@@ -135,7 +136,7 @@ def _is_fusible_mul(mul_node: Node) -> bool:
135136
and _is_cask_fusible(consumer_node, partition_node_outputs)
136137
)
137138
or (
138-
consumer_node.op in ["BatchNormalization", "Relu"]
139+
consumer_node.op in ["MaxPool", "BatchNormalization", "Relu"]
139140
and get_fusible_backbone(consumer_node, graph)
140141
)
141142
or _is_on_non_residual_path(consumer_node)

0 commit comments

Comments
 (0)