def rename_node_output(self, node_name: str, old_output: str, new_output: str):
        """Rename an output of a node.

        :param node_name: name of the node.
        :param old_output: name of the output to rename.
        :param new_output: new name of the output.
        """
        assert not self.is_output(old_output), f"Output {old_output} is a model output. Can't rename it."
        assert new_output not in self.ios, f"Output {new_output} already exists in the graph."
        node = self.nodes[node_name]
        assert old_output in node.outputs, f"Output {old_output} does not exist in node {node_name}."

        original_io = self.ios[old_output]
        new_proto = []
        for proto in original_io.proto:
            value_info = ValueInfoProto()
            value_info.CopyFrom(proto)
            value_info.name = new_output
            new_proto.append(value_info)

        self.ios[new_output] = OnnxIO(graph_idx=original_io.graph_idx, proto=new_proto, source=original_io.source)

        # update the node object and proto
        node = self.nodes[node_name]
        node.outputs[node.outputs.index(old_output)] = new_output
        for i in range(len(node.outputs)):
            if node.proto.output[i] == old_output:
                node.proto.output[i] = new_output

        # replace the input of consumers
        for consumer in self.get_consumers(node_name):
            self.replace_node_input(consumer, old_output, new_output)

        # delete the old output
        self.ios.pop(old_output)
Rename an output of a node.

        :param node_name: name of the node.
        :param old_output: name of the output to rename.
        :param new_output: new name of the output.
        
olive/passes/onnx/onnx_dag.py