Skip to content

Commit a998e5d

Browse files
authored
Make TransposeIdentity more robust (#2443)
A quick change to make the `TransposeIdentity` rule more robust. Since `as_ints` returns a Sequence we cannot assume it is a list. Signed-off-by: Justin Chu <[email protected]>
1 parent f42c2bb commit a998e5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

onnxscript/rewriter/basic_rules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ def check(self, context, x: ir.Value, perm: ir.Attr) -> MatchResult:
206206
if perm.is_ref():
207207
return check_result.fail("Permutation is a reference attribute.")
208208
if perm.type == ir.AttributeType.INTS:
209-
perm_ints = perm.as_ints()
210-
if perm_ints == list(range(len(perm_ints))):
209+
perm_ints = tuple(perm.as_ints())
210+
if perm_ints == tuple(range(len(perm_ints))):
211211
return check_result
212212
return check_result.fail("Permutation is not identity.")
213213

0 commit comments

Comments
 (0)