@compatibility(is_backward_compatible=True)
def replace_all_uses_with(self, replace_with: 'Node') -> List['Node']:
    '\n        Replace all uses of ``self`` in the Graph with the Node ``replace_with``.\n\n        Args:\n\n            replace_with (Node): The node to replace all uses of ``self`` with.\n\n        Returns:\n\n            The list of Nodes on which this change was made.\n        '
    to_process = list(self.users)
    for use_node in to_process:

        def maybe_replace_node(n: Node) -> Node:
            if (n == self):
                return replace_with
            else:
                return n
        new_args = map_arg(use_node.args, maybe_replace_node)
        new_kwargs = map_arg(use_node.kwargs, maybe_replace_node)
        assert isinstance(new_args, tuple)
        assert isinstance(new_kwargs, dict)
        use_node.__update_args_kwargs(new_args, new_kwargs)
    assert (len(self.users) == 0)
    return to_process
Replace all uses of ``self`` in the Graph with the Node ``replace_with``.

Args:

    replace_with (Node): The node to replace all uses of ``self`` with.

Returns:

    The list of Nodes on which this change was made.
@compatibility(is_backward_compatible=True)
def replace_all_uses_with(self, replace_with: 'Node') -> List['Node']:
    '\n        Replace all uses of ``self`` in the Graph with the Node ``replace_with``.\n\n        Args:\n\n            replace_with (Node): The node to replace all uses of ``self`` with.\n\n        Returns:\n\n            The list of Nodes on which this change was made.\n        '
    to_process = list(self.users)
    for use_node in to_process:

        def maybe_replace_node(n: Node) -> Node:
            if (n == self):
                return replace_with
            else:
                return n
        new_args = map_arg(use_node.args, maybe_replace_node)
        new_kwargs = map_arg(use_node.kwargs, maybe_replace_node)
        assert isinstance(new_args, tuple)
        assert isinstance(new_kwargs, dict)
        use_node.__update_args_kwargs(new_args, new_kwargs)
    assert (len(self.users) == 0)
    return to_process