Skip to content

Add backward compatible types to pt2e prepare #2244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions torchao/quantization/pt2e/quantize_pt2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
if TORCH_VERSION_AT_LEAST_2_7:
from .constant_fold import constant_fold

from typing import Union

from torch.fx import GraphModule, Node
from torch.fx.passes.infra.pass_manager import PassManager

Expand Down Expand Up @@ -39,7 +41,7 @@

def prepare_pt2e(
model: GraphModule,
quantizer: Quantizer,
quantizer: Union[Quantizer, torch.ao.quantization.quantizer.quantizer.Quantizer],
) -> GraphModule:
"""Prepare a model for post training quantization

Expand Down Expand Up @@ -127,7 +129,7 @@ def calibrate(model, data_loader):

def prepare_qat_pt2e(
model: GraphModule,
quantizer: Quantizer,
quantizer: Union[Quantizer, torch.ao.quantization.quantizer.quantizer.Quantizer],
) -> GraphModule:
"""Prepare a model for quantization aware training

Expand Down
Loading