File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ python_library(
28
28
"compiler.py",
29
29
],
30
30
deps = [
31
+ "fbsource//third-party/pypi/pyre-extensions:pyre-extensions",
31
32
":passes",
32
33
":utils",
33
34
"//caffe2:torch",
Original file line number Diff line number Diff line change 18
18
ReplaceSqueezeAndUnsqueezeWithViewPass ,
19
19
)
20
20
from executorch .backends .cadence .aot .quantizer .fusion_pass import QuantFusion
21
- from executorch .backends .cadence .aot .quantizer .quantizer import CadenceQuantizer
21
+ from executorch .backends .cadence .aot .quantizer .quantizer import (
22
+ CadenceGenericQuantizer ,
23
+ CadenceQuantizer ,
24
+ )
22
25
from executorch .backends .cadence .aot .utils import model_is_quantized
23
26
from executorch .exir import EdgeCompileConfig , EdgeProgramManager , to_edge
27
+ from pyre_extensions import assert_is_instance
24
28
from torch ._export import capture_pre_autograd_graph
25
29
from torch .ao .quantization .pt2e .export_utils import model_is_exported
26
30
from torch .ao .quantization .quantize_pt2e import convert_pt2e , prepare_pt2e
@@ -53,8 +57,10 @@ def quantize_pt2(
53
57
converted_model = convert_pt2e (prepared_model )
54
58
55
59
# Get patterns and apply fusion of dq -> op -> q to qop
56
- # pyre-fixme[16]: Pyre doesn't get that CadenceQuantizer has a patterns attribute
57
- patterns = [q .pattern for q in quantizer .quantizers ]
60
+ patterns = [
61
+ assert_is_instance (q , CadenceGenericQuantizer ).pattern
62
+ for q in quantizer .quantizers
63
+ ]
58
64
QuantFusion (patterns )(converted_model )
59
65
60
66
return converted_model
You can’t perform that action at this time.
0 commit comments