Skip to content

Commit 495cfd0

Browse files
cccclaifacebook-github-bot
authored andcommitted
fix a set union bug
Summary: It's a bug, we need to keep union the original set with the new set from the for loop, however the original code just overwrite the original set. Test with coreml + llama code ``` python3 -m examples.models.llama2.export_llama --coreml --use_kv_cache ``` Differential Revision: D55680296
1 parent bd6ceab commit 495cfd0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

exir/backend/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ def _maybe_duplicate_constant_nodes(
246246
copied_nodes = set()
247247
for candidate_node in candidate_nodes:
248248
# Both tagged exported program and the owning program need to go through the same duplication pass
249-
copied_nodes = duplicate_constant_node(tagged_exported_program, candidate_node)
249+
copied_nodes = copied_nodes.union(
250+
duplicate_constant_node(tagged_exported_program, candidate_node)
251+
)
250252
duplicate_constant_node(owning_program, candidate_node)
251253
candidate_node_with_copies = candidate_nodes.union(copied_nodes)
252254
_assign_new_tag(tagged_exported_program, candidate_node_with_copies)

0 commit comments

Comments
 (0)