def get_pos_overflow(f_tensor, bit_width=8):
    """
    Obtain the fixed-point position values using the non overflow method with power of 2 scale.
    """
    x_min = f_tensor.min()
    x_max = f_tensor.max()
    #  Use 0.5 as a guard
    lower_bound = -(2 ** (bit_width - 1)) - 0.5
    upper_bound = 2 ** (bit_width - 1) - 0.5
    scale = max(x_min / lower_bound, x_max / upper_bound)
    if scale == 0:
        # Set pos to 127(max of uint8) for all zero
        return 127
    else:
        pos = np.floor(np.log2(1 / scale))
        pos = 127 if pos > 127 else pos
        pos = -128 if pos < -128 else pos
    return pos

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