def _add_special_input(
        self,
        proto: Union[ValueInfoProto, TensorProto],
        graph_idx: int,
        i_type: SpecialInput,
        keep_existing: bool = False,
    ):
        """Add a special input to the graph.

        :param proto: ValueInfoProto or TensorProto of the input.
        :param graph_idx: index of the graph in the model.
        :param i_type: type of the special input.
        :param keep_existing: whether to keep the existing input/initializer if it exists with the same name.
        """
        name = proto.name
        proto_list = [proto]
        destination = []
        # type and proto index for the other type
        other_type = SpecialInput.INITIALIZER
        other_index = 1
        if i_type == SpecialInput.INITIALIZER:
            other_type = SpecialInput.INPUT
            other_index = 0
        if name in self.ios and not (keep_existing and self.ios[name].source == other_type):
            raise ValueError(f"{i_type} {name} already exists in the graph.")
        elif name in self.ios:
            # keep the other type
            i_type = SpecialInput.INPUT_INITIALIZER
            proto_list.insert(other_index, self.ios[name].proto[0])
            destination = self.ios[name].destination

        self.ios[name] = OnnxIO(proto=proto_list, source=i_type, graph_idx=graph_idx, destination=destination)
Add a special input to the graph.

        :param proto: ValueInfoProto or TensorProto of the input.
        :param graph_idx: index of the graph in the model.
        :param i_type: type of the special input.
        :param keep_existing: whether to keep the existing input/initializer if it exists with the same name.
        
olive/passes/onnx/onnx_dag.py