def scale2pos(scale):
    """
    Obtain the fixed-point position corresponding to the scale.
    """
    if scale > 2**127:
        return 127
    if scale < 2 ** (-128):
        return -128
    return int(np.rint(-np.log2(scale)))

    Obtain the fixed-point position corresponding to the scale.
    
olive/passes/onnx/vitis_ai/quant_utils.py