Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fallback to deepcopy when fake program fails (#2564)
Summary:
Pull Request resolved: #2564

Catch the general Exception case, not only AssertionError.

Reviewed By: cccclai

Differential Revision: D55204315
  • Loading branch information
lucylq authored and facebook-github-bot committed Mar 21, 2024
commit 946406a450a32435a21b405c1280e26da76139fa
6 changes: 4 additions & 2 deletions exir/backend/backend_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,10 @@ def to_backend(
# Fall back to deepcopy if no fake mode is found. TODO(T182910699): Remove this fallback.
try:
fake_edge_program = get_fake_program(edge_program)
except AssertionError as e:
logging.warning(f"No fake mode found for {edge_program.graph_module}: {e}")
except Exception as e:
logging.warning(
f"Error in get_fake_program for graph {edge_program.graph_module}, fallback to deepcopy: {e}"
)
fake_edge_program = copy.deepcopy(edge_program)
partitioner_result = partitioner_instance(fake_edge_program)
tagged_exported_program = partitioner_result.tagged_exported_program
Expand Down