def __init__(
        self,
        session: "InferenceSession",
        io_bind: bool = False,
        device: str = "cpu",
        shared_kv_buffer: bool = False,
        use_fp16: bool = False,
        input_feed: Optional[dict[str, "NDArray"]] = None,
        constant_inputs: Optional[dict[str, "NDArray"]] = None,
    ):
        """Initialize self.

        :param session: ONNXRuntime InferenceSession
        :param io_bind: Whether to use IO binding. Default is False.
        :param device: Device to run inference on. Default is "cpu".
        :param shared_kv_buffer: Whether to share the key/value buffer across multiple runs.
            Default is False. Only valid if io_bind is True.
        :param use_fp16: Whether to use fp16. Default is False. Both shared_kv_buffer and use_fp16 must be True
            at the same time to use shared key/value buffer.
        :param input_feed: Optional input feed for the session. Required when shared_kv_buffer and use_fp16 are True.
        :param constant_inputs: Optional constant inputs for the session. These will be passed to the session every
            inference run.
        """
        # TODO(anyone): use_fp16 is redundant with shared_kv_buffer. Remove it.
        self.session = session
        self.io_bind = io_bind
        self.device = device
        self.shared_kv_buffer = shared_kv_buffer
        self.use_fp16 = use_fp16
        self.kv_cache_ortvalues = {} if (self.shared_kv_buffer and self.use_fp16) else None
        # TODO(jambayk): investigate if io binding can be run without having to bind constant
        # inputs every time.
        self.constant_inputs = constant_inputs or {}

        self.io_binding = None
        if self.io_bind:
            self.io_binding = self.session.io_binding()
            if self.shared_kv_buffer and self.use_fp16:
                assert input_feed is not None, "input_feed is required when shared_kv_buffer and use_fp16 are True"
                bind_input_data(
                    self.io_binding,
                    {**input_feed, **self.constant_inputs},
                    self.use_fp16,
                    self.device,
                    shared_kv_buffer=self.shared_kv_buffer,
                    kv_cache_ortvalues=self.kv_cache_ortvalues,
                )
            bind_output_data(
                self.io_binding,
                self.session.get_outputs(),
                self.use_fp16,
                self.device,
                shared_kv_buffer=self.shared_kv_buffer,
                kv_cache_ortvalues=self.kv_cache_ortvalues,
            )
Initialize self.

        :param session: ONNXRuntime InferenceSession
        :param io_bind: Whether to use IO binding. Default is False.
        :param device: Device to run inference on. Default is "cpu".
        :param shared_kv_buffer: Whether to share the key/value buffer across multiple runs.
            Default is False. Only valid if io_bind is True.
        :param use_fp16: Whether to use fp16. Default is False. Both shared_kv_buffer and use_fp16 must be True
            at the same time to use shared key/value buffer.
        :param input_feed: Optional input feed for the session. Required when shared_kv_buffer and use_fp16 are True.
        :param constant_inputs: Optional constant inputs for the session. These will be passed to the session every
            inference run.
        
olive/common/ort_inference.py