Skip frame if the graph is empty (#105228)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/105228
Approved by: https://github.com/anijain2305
This commit is contained in:
Tugsbayasgalan Manlaibaatar 2023-07-17 09:57:52 -07:00 committed by PyTorch MergeBot
parent 0af287cef2
commit d623f22b8b

View File

@ -477,6 +477,16 @@ def _compile(
)
assert output is not None
# Skipping Dynamo on a frame without any extracted graph.
# This does not affect eager functionality. But this is necessary
# for export for cases where Dynamo-reconstructed bytecode can create
# new function frames, confusing export in thinking that there
# are extra graphs now.
if output.export and output.is_empty_graph():
return None
assert output.guards is not None
CleanupManager.instance[out_code] = output.cleanups
check_fn = CheckFunctionManager(