def quantize_initializer_impl(self, weight, qType, reduce_range=False, keep_float_weight=False):
            """
            :param weight: TensorProto initializer
            :param qType: type to quantize to
            :param keep_float_weight: Whether to quantize the weight. In some cases, we only want to qunatize scale and zero point.
                                    If keep_float_weight is False, quantize the weight, or don't quantize the weight.
            :return: quantized weight name, zero point name, scale name
            """
            q_weight_name = weight.name + TENSOR_NAME_QUANT_SUFFIX
            zp_name = weight.name + "_zero_point"
            scale_name = weight.name + "_scale"

            # Quantize weight data. Use quantization overrides if provided by the user.
            weight_data = tensor_proto_to_array(weight)
            quant_overrides = self.tensor_quant_overrides.get_per_tensor_overrides(weight.name, default_val={})
            if "quant_type" in quant_overrides:
                qType = quant_overrides["quant_type"].tensor_type  # noqa: N806

            if "scale" in quant_overrides and "zero_point" in quant_overrides:
                zero_point = np.array(quant_overrides["zero_point"], dtype=ONNX_TYPE_TO_NP_TYPE[qType])
                scale = np.array(quant_overrides["scale"])
                q_weight_data = quantize_nparray(qType, weight_data.flatten(), scale, zero_point)
                assert isinstance(zero_point, np.ndarray), f"Unexpected type {type(zero_point)}"
                assert zero_point.dtype != np.float32 and zero_point.dtype != np.float16, (
                    f"Unexpected dtype {zero_point.dtype}"
                )
                assert isinstance(scale, np.ndarray), f"Unexpected type {type(scale)}"

            else:
                _, _, zero_point, scale, q_weight_data = quantize_data_pof2s(
                    weight_data.flatten(),
                    qType,
                    self.is_weight_symmetric,
                    self.reduce_range and reduce_range,
                    method=PowerOfTwoMethod.NonOverflow,
                )

                assert isinstance(zero_point, np.ndarray), f"Unexpected type {type(zero_point)}"
                assert zero_point.dtype != np.float32 and zero_point.dtype != np.float16, (
                    f"Unexpected dtype {zero_point.dtype}"
                )
                assert isinstance(scale, np.ndarray), f"Unexpected type {type(scale)}"

            scale_dtype = weight.data_type
            scale_initializer = onnx.helper.make_tensor(scale_name, scale_dtype, [], scale.reshape((-1,)).tolist())
            zero_initializer = onnx.helper.make_tensor(zp_name, qType, [], zero_point.reshape((-1,)).tolist())
            self.model.initializer_extend([scale_initializer, zero_initializer])

            if not keep_float_weight:
                if self.weight_qType == onnx.TensorProto.FLOAT8E4M3FN:
                    q_weight_initializer = onnx.TensorProto()
                    q_weight_initializer.data_type = self.weight_qType
                    q_weight_initializer.dims.extend(weight.dims)
                    q_weight_initializer.name = q_weight_name
                    # Do not remove .flatten().copy() numpy is not clear about data persistence.
                    q_weight_initializer.raw_data = q_weight_data.flatten().copy().tobytes()
                    if to_array_extended is not None:
                        # This test should not be needed but it helped catch some issues
                        # with data persistence and tobytes.
                        check = to_array_extended(q_weight_initializer)
                        if check.shape != weight_data.shape or check.tobytes() != q_weight_data.tobytes():
                            raise RuntimeError(
                                f"The initializer of shape {weight_data.shape} could not be created, expecting "
                                f"{q_weight_data.tobytes()[:10]}, got {check.tobytes()[:10]} and shape={weight.shape}"
                                f"\nraw={str(q_weight_initializer)[:200]}."
                            )
                else:
                    q_weight_data = np.asarray(
                        q_weight_data, dtype=onnx.helper.tensor_dtype_to_np_dtype(qType)
                    ).reshape(weight.dims)
                    q_weight_initializer = onnx.numpy_helper.from_array(q_weight_data, q_weight_name)
                self.model.initializer_extend([q_weight_initializer])

            return q_weight_name, zp_name, scale_name

            :param weight: TensorProto initializer
            :param qType: type to quantize to
            :param keep_float_weight: Whether to quantize the weight. In some cases, we only want to qunatize scale and zero point.
                                    If keep_float_weight is False, quantize the weight, or don't quantize the weight.
            :return: quantized weight name, zero point name, scale name
            
olive/passes/onnx/vitis_ai/quantizer.py