def get_pos_min_mse(f_tensor, bit_width=8, pos_range=5):
    """
    Obtain the fixed-point position values using the min mse method with power of 2 scale.
    """
    pos_overflow = get_pos_overflow(f_tensor, bit_width)
    if pos_overflow == 127:
        # Set pos to 127(max of uint8) for all zero
        return 127

    pos_diffs = pos_overflow
    diff_min = float("inf")
    for i in range(pos_range):
        tmp_pos = pos_overflow + i
        q_tensor = vitis_quantize(f_tensor, tmp_pos, bit_width=bit_width)
        diff = np.sum((q_tensor - f_tensor) ** 2)
        if diff < diff_min:
            diff_min = diff
            pos_diffs = tmp_pos
    return pos_diffs

    Obtain the fixed-point position values using the min mse method with power of 2 scale.
    
olive/passes/onnx/vitis_ai/quant_utils.py