You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding Tests for CadenceFusedConvReluQuantizer (#16358)
Summary:
Pull Request resolved: #16358
A fused pattern is when the quantizer recognizes a sequence of operations and treats as a single unit for quantization purposes. So for example, for a Conv2D + ReLU fusion, rather than having something like this:
```
input → [quantize] → conv2d → [dequantize] → [quantize] → relu → [dequantize] → output
```
a fused pattern quantizes them together like so:
```
input → [quantize] → conv2d → relu → [dequantize] → output
```
We need to make a few changes in our framework to test this.
# Change 1: We allow graph builders to return a 3rd element for fused patterns
For fused patterns like conv+relu, the quantization annotations are split across two nodes:
- Output annotation is on the relu node (the final output of the fused pattern)
- Input annotations are on the conv node (where the quantized inputs enter)
The existing graph builders return (gm, target_node), which works for single-op patterns where both annotations are on the same node. For fused patterns, we need to know both nodes, so graph builders can now optionally return (gm, output_node, input_source_node).
# Change 2: We check annotations on the correct nodes for fused patterns
The test previously assumed output_qspec and input_qspec_map were both on the same node. For fused patterns, they're on different nodes:
- output_qspec is checked on the output node (relu)
- input_qspec_map is checked on the input source node (conv)
This change is backwards-compatible: for non-fused patterns, both nodes are the same.
Reviewed By: hsharma35
Differential Revision: D89630759
0 commit comments