From cb4f4cbe7fbcf59eae07d4e0db9a58b60daeae5c Mon Sep 17 00:00:00 2001 From: Andrew Grebenisan Date: Tue, 30 Dec 2025 08:28:06 -0800 Subject: [PATCH] Fix T248482926 (#16409) Summary: Zero point was a fake tensor, needed to be real for visualization. Reviewed By: hsharma35, ethansfng Differential Revision: D89898065 --- backends/cadence/aot/replace_ops.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/backends/cadence/aot/replace_ops.py b/backends/cadence/aot/replace_ops.py index 5dc8bb0b297..d368dc4e77e 100644 --- a/backends/cadence/aot/replace_ops.py +++ b/backends/cadence/aot/replace_ops.py @@ -19,10 +19,7 @@ import torch import torch.fx -from executorch.backends.cadence.aot.compiler_utils import ( - get_zero_point, - quantize_tensor_multiplier, -) +from executorch.backends.cadence.aot.compiler_utils import quantize_tensor_multiplier from executorch.backends.cadence.aot.fuse_ops import ( FuseCascadedTransposeOrPermuteOps, FuseCascadedViewOps, @@ -1463,10 +1460,12 @@ def maybe_remove_or_replace(self, node: torch.fx.Node) -> bool: kernel_size = list(weight_shape[1:-1] if channel_last else weight_shape[2:]) # If the transposed_convolution op was quantized, we need the input tensor's # zero_point for im2row. Otherwise in_zero_point defaults to a zero - # tensor. + # tensor. For quantized ops, the input_zero_point is at args[8] as an int, + # and we need to convert it to a tensor since transposed_im2row expects + # a Tensor for in_zero_point (unlike im2row which expects an int). assert isinstance(in_tensor, torch.fx.Node) in_zero_point = ( - get_zero_point(in_tensor.meta["val"]) + torch.tensor(node.args[8], dtype=torch.int32) if quantized_op else torch.tensor(0, dtype=torch.int32) )