Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IR] Fix error message with remove(..., safe=True) #1768

Merged
merged 4 commits into from
Aug 1, 2024
Merged
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
10 changes: 5 additions & 5 deletions onnxscript/ir/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,12 +1647,12 @@ def _check_node_safe_to_remove(
raise ValueError(
f"Node '{node!r}' is still an output of the graph and cannot be removed when safe=True."
)
for use, _ in output.uses():
if use in to_remove:
continue
uses_not_to_remove = [user for user, _ in output.uses() if user not in to_remove]
if uses_not_to_remove:
raise ValueError(
f"Node '{use!r}' is still being used by other nodes that are not to be "
f"removed. All of its uses: {list(output.uses())!r}"
f"Output value '{output!r}' is still being used by other nodes that are not to be "
f"removed. All of its users that is not being removed: {uses_not_to_remove!r}. "
"Please make sure these nodes are no longer using the output value."
)


Expand Down
Loading