Skip to content

Commit 8cf64f3

Browse files
mcr229facebook-github-bot
authored andcommitted
add convert scalars to attrs pass in quantize tester stage (#576)
Summary: Pull Request resolved: #576 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: digantdesai, jerryzh168 Differential Revision: D49850601 fbshipit-source-id: 5686325a49a965cc61723f8c626a9fd6ae89af2f
1 parent 6f970f9 commit 8cf64f3

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)