Skip to content

Commit 9d00df8

Browse files
lucylqfacebook-github-bot
authored andcommitted
Fallback to deepcopy when fake program fails (pytorch#2564)
Summary: Catch the general Exception case, not only AssertionError. Differential Revision: D55204315
1 parent 12b5324 commit 9d00df8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

exir/backend/backend_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ def to_backend(
351351
# Fall back to deepcopy if no fake mode is found. TODO(T182910699): Remove this fallback.
352352
try:
353353
fake_edge_program = get_fake_program(edge_program)
354-
except AssertionError as e:
355-
logging.warning(f"No fake mode found for {edge_program.graph_module}: {e}")
354+
except Exception as e:
355+
logging.warning(
356+
f"Error in get_fake_program for graph {edge_program.graph_module}, fallback to deepcopy: {e}"
357+
)
356358
fake_edge_program = copy.deepcopy(edge_program)
357359
partitioner_result = partitioner_instance(fake_edge_program)
358360
tagged_exported_program = partitioner_result.tagged_exported_program

0 commit comments

Comments
 (0)