File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1647,12 +1647,12 @@ def _check_node_safe_to_remove(
1647
1647
raise ValueError (
1648
1648
f"Node '{ node !r} ' is still an output of the graph and cannot be removed when safe=True."
1649
1649
)
1650
- for use , _ in output .uses ():
1651
- if use in to_remove :
1652
- continue
1650
+ uses_not_to_remove = [user for user , _ in output .uses () if user not in to_remove ]
1651
+ if uses_not_to_remove :
1653
1652
raise ValueError (
1654
- f"Node '{ use !r} ' is still being used by other nodes that are not to be "
1655
- f"removed. All of its uses: { list (output .uses ())!r} "
1653
+ f"Output value '{ output !r} ' is still being used by other nodes that are not to be "
1654
+ f"removed. All of its users that is not being removed: { uses_not_to_remove !r} . "
1655
+ "Please make sure these nodes are no longer using the output value."
1656
1656
)
1657
1657
1658
1658
You can’t perform that action at this time.
0 commit comments