Skip to content

Commit 9a30bd3

Browse files
authored
Update remaining callsites to not use pt2e quant API from pytorch
Differential Revision: D89744472 Pull Request resolved: #16380
1 parent d4ce813 commit 9a30bd3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

backends/nxp/quantizer/neutron_quantizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
no_outside_users,
5454
)
5555
from torch import fx
56-
from torch.ao.quantization.quantizer.utils import _annotate_output_qspec
5756
from torchao.quantization.pt2e import (
5857
FakeQuantize,
5958
FusedMovingAvgObsFakeQuantize,
@@ -62,6 +61,7 @@
6261
MovingAverageMinMaxObserver,
6362
)
6463
from torchao.quantization.pt2e.quantizer import (
64+
annotate_output_qspec,
6565
ComposableQuantizer,
6666
DerivedQuantizationSpec,
6767
OperatorConfig,
@@ -338,7 +338,7 @@ def _annotate_inputs(self, model: fx.GraphModule):
338338
continue
339339

340340
if node.op == "placeholder" and len(node.users) > 0:
341-
_annotate_output_qspec(node, act_qspec(self.is_qat))
341+
annotate_output_qspec(node, act_qspec(self.is_qat))
342342
self._mark_input_node_as_annotated(node)
343343

344344
def validate(self, model: torch.fx.GraphModule) -> None:

backends/nxp/quantizer/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
import torch
1616
from torch import fx
1717
from torch._ops import OpOverload
18-
from torch.ao.quantization import move_exported_model_to_eval
1918
from torch.export import ExportedProgram
2019
from torch.fx.passes.utils.source_matcher_utils import (
2120
check_subgraphs_connected,
2221
SourcePartition,
2322
)
24-
from torchao.quantization.pt2e import ObserverOrFakeQuantize
23+
from torchao.quantization.pt2e import (
24+
move_exported_model_to_eval,
25+
ObserverOrFakeQuantize,
26+
)
2527
from torchao.quantization.pt2e.quantize_pt2e import (
2628
convert_pt2e,
2729
prepare_pt2e,

0 commit comments

Comments
 (0)