Skip to content

Commit f9efb05

Browse files
tarun292facebook-github-bot
authored andcommitted
Create exceptions for spec.const in verify_graph_input_output (#4083)
Summary: Pull Request resolved: #4083 The ASR model triggered an edge case where when we run constant_prop_pass it creates a constant in the placeholders which is then directly returned as an output of the model. When this is done the check in `verify_graph_input_output` fails because for the placeholder constant that is returned as an output we have no mem_offset (as expected). In order to handle this case we'll filter out specs from this list that are constants and then do the checks. Reviewed By: larryliu0820 Differential Revision: D59140916 fbshipit-source-id: 9a2fc99d36a1c53b06130c3bdef7f5ee2cd7c769
1 parent e453652 commit f9efb05

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

exir/memory_planning.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ def verify_graph_input_output(self) -> None:
219219
if _is_mutable_buffer(nd, self.graph_signature):
220220
continue
221221
assert len(specs) > 0, "Expect tensor specs"
222+
specs = list(filter(lambda spec: not spec.const, specs))
223+
if len(specs) == 0:
224+
continue
222225
allocated = any(
223226
spec is None or spec.mem_offset is not None for spec in specs
224227
)

0 commit comments

Comments
 (0)