Skip to content

Commit

Permalink
Skip frame if the graph is empty (pytorch#105228)
Browse files Browse the repository at this point in the history
Pull Request resolved: pytorch#105228
Approved by: https://github.com/anijain2305
  • Loading branch information
tugsbayasgalan authored and pytorchmergebot committed Jul 17, 2023
1 parent 0af287c commit d623f22
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions torch/_dynamo/convert_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,16 @@ def log_bytecode(prefix, name, filename, line_no, code):
)

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(
Expand Down

0 comments on commit d623f22

Please sign in to comment.