Skip to content

Commit b281af7

Browse files
committed
When replacing literals with placeholders lists are always converted to
tuples Summary: THis is needed because lists are not hashable, since they are mutable, and as a result we cannot have literals_to_ph in pattern rewrites used inside reference_representation_rewrite.py Test Plan: CI + next diff relies on this feature Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 7fc2876 Pull Request resolved: #2518
1 parent f24f37b commit b281af7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

torchao/quantization/pt2e/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,8 @@ def replacement(x_i8, scale, zero_point, quant_min, quant_max):
10311031
continue
10321032
new_args = []
10331033
for arg in node.args:
1034+
if isinstance(arg, list):
1035+
arg = tuple(arg) # type: ignore[assignment]
10341036
if (
10351037
_is_literal(arg)
10361038
and arg not in exclude_literals

0 commit comments

Comments
 (0)