Skip to content

Commit 35531a0

Browse files
mcr229facebook-github-bot
authored andcommitted
add convert scalars to attrs pass in quantize tester stage
Summary: We are adding the pass to convert scalars to attrs into our quantize testing stage. This allows us to test end to end flow of models with quantized scalars Reviewed By: jerryzh168 Differential Revision: D49850601 fbshipit-source-id: 450ad8c2654895589d4719efeebc5fe2805aef87
1 parent d7c054e commit 35531a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backends/xnnpack/test/tester/tester.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
get_symmetric_quantization_config,
3737
XNNPACKQuantizer,
3838
)
39-
from torch.ao.quantization.quantizer.xnnpack_quantizer_utils import QuantizationConfig
39+
from torch.ao.quantization.quantizer.xnnpack_quantizer_utils import (
40+
convert_scalars_to_attrs,
41+
QuantizationConfig,
42+
)
4043
from torch.testing import FileCheck
4144
from torch.utils._pytree import tree_flatten
4245

@@ -105,6 +108,7 @@ def run(
105108
self, artifact: torch.nn.Module, inputs: Optional[Tuple[torch.Tensor]]
106109
) -> None:
107110
captured_graph = export.capture_pre_autograd_graph(artifact, inputs)
111+
captured_graph = convert_scalars_to_attrs(captured_graph)
108112
prepared = prepare_pt2e(captured_graph, self.quantizer)
109113
converted = convert_pt2e(prepared)
110114
self.converted_graph = converted

0 commit comments

Comments
 (0)