Skip to content

Commit c45d514

Browse files
authored
Handle case when native_schema is None
Differential Revision: D71413713 Pull Request resolved: #9377
1 parent f23616c commit c45d514

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

exir/program/_program.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -995,17 +995,22 @@ def keep(op):
995995

996996
schema = op._schema
997997
native_schema = _pybind_schema_to_native_schema(schema)
998-
if native_schema.is_mutable:
998+
if native_schema is None:
999999
logging.warn(
1000-
f"Op {op} was requested for preservation by partitioner. This request is ignored because it is mutable."
1000+
f"Torchgen is not able to parse the schema of {op._schema}. This is not fatal."
10011001
)
1002-
return False
1002+
else:
1003+
if native_schema.is_mutable:
1004+
logging.warn(
1005+
f"Op {op} was requested for preservation by partitioner. This request is ignored because it is mutable."
1006+
)
1007+
return False
10031008

1004-
if native_schema.aliased_return_names() != [None]:
1005-
logging.warn(
1006-
f"Op {op} was requested for preservation by partitioner. This request is ignored because it aliases output."
1007-
)
1008-
return False
1009+
if native_schema.aliased_return_names() != [None]:
1010+
logging.warn(
1011+
f"Op {op} was requested for preservation by partitioner. This request is ignored because it aliases output."
1012+
)
1013+
return False
10091014

10101015
# Explicit block list of ops that don't work if asked for
10111016
# preservation

0 commit comments

Comments
 (0)