Skip to content

Commit fcb51be

Browse files
JakeStevensfacebook-github-bot
authored andcommitted
guard dimname after removal (#20071)
Summary: PyTroch PR #173895 removed dim name support This diff catches that this attribute may no longer be available, but retains backward compatibility as existing models may still have it and be re-exported/quantized/etc Reviewed By: digantdesai, jbschlosser Differential Revision: D107662981
1 parent 502fdbe commit fcb51be

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

backends/arm/quantizer/quantization_annotator.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ def _match_pattern(
547547
torch.ops.aten.split.Tensor,
548548
torch.ops.aten.split_with_sizes.default,
549549
torch.ops.aten.split_copy.Tensor,
550-
torch.ops.aten.transpose.Dimname,
551550
torch.ops.aten.transpose.int,
552551
torch.ops.aten.transpose_copy.int,
553552
torch.ops.aten.t_copy.default,
@@ -575,6 +574,15 @@ def _match_pattern(
575574
torch.ops.aten.detach_copy.default,
576575
}
577576

577+
# Dimname has been removed from upstream PyTorch, but there may be a window
578+
# where developers in this backend are using a mainline build of this backend
579+
# with an older version of PyTorch.
580+
# TODO: remove this once the build has time to be propagated and majority of
581+
# dev expected to be unimpacted
582+
_transpose_dimname = getattr(torch.ops.aten.transpose, "Dimname", None)
583+
if _transpose_dimname is not None:
584+
_one_to_one_shared_input_qspec.add(_transpose_dimname)
585+
578586
_one_to_one_shared_input_or_input_act_qspec: set[OpOverload] = {
579587
torch.ops.aten.alias.default,
580588
torch.ops.aten.clone.default,

0 commit comments

Comments
 (0)