Skip to content

Commit

Permalink
[pt2e][xnnpack_quantizer] quantize "mul" (pytorch#110428)
Browse files Browse the repository at this point in the history
Adding "mul" to list of partitions that are supported by the quantizer. This shows up in EDSR, where we still want to quantize the mul op

Differential Revision: [D49850151](https://our.internmc.facebook.com/intern/diff/D49850151/)
Pull Request resolved: pytorch#110428
Approved by: https://github.com/jerryzh168
ghstack dependencies: pytorch#110427
  • Loading branch information
mcr229 authored and pytorchmergebot committed Oct 4, 2023
1 parent 66202ed commit 08c7dcd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion torch/ao/quantization/pt2e/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{torch.nn.BatchNorm2d, torch.nn.functional.batch_norm},
{torch.nn.Hardtanh, torch.nn.functional.hardtanh, torch.nn.functional.hardtanh_},
{torch.add, operator.add, operator.iadd, "add", "add_"},
{torch.mul, operator.mul, operator.imul},
{torch.mul, operator.mul, operator.imul, "mul", "mul_"},
]


Expand Down
2 changes: 1 addition & 1 deletion torch/ao/quantization/quantizer/xnnpack_quantizer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def _annotate_mul(
filter_fn: Optional[Callable[[Node], bool]] = None,
) -> Optional[List[List[Node]]]:
mul_partitions = get_source_partitions(
gm.graph, [operator.mul, torch.mul, operator.imul], filter_fn
gm.graph, ["mul", "mul_", operator.mul, torch.mul, operator.imul], filter_fn
)
mul_partitions = list(itertools.chain(*mul_partitions.values()))
annotated_partitions = []
Expand Down

0 comments on commit 08c7dcd

Please sign in to comment.