



"""simple docstring"""
from collections.abc import Callable





def  lowerCamelCase_						(UpperCamelCase__		:		Callable[[float], float]     ,       UpperCamelCase__		:		float     ,       UpperCamelCase__		:		float							):
    _UpperCAmelCase							:  float											=    a
    _UpperCAmelCase							:  float											=    b
    if function(UpperCamelCase__							) == 0:  # one of the a or b is a root for the function
        return a
    elif function(UpperCamelCase__							) == 0:
        return b
    elif (
        function(UpperCamelCase__							) * function(UpperCamelCase__							) > 0
    ):  # if none of these are root and they are both positive or negative,
        # then this algorithm can't find the root
        raise ValueError('''could not find root in given interval.'''							)
    else:
        _UpperCAmelCase							:  float											=    start + (end - start) / 2.0
        while abs(start - mid							) > 10**-7:  # until precisely equals to 10^-7
            if function(UpperCamelCase__							) == 0:
                return mid
            elif function(UpperCamelCase__							) * function(UpperCamelCase__							) < 0:
                _UpperCAmelCase							:  Optional[Any]											=    mid
            else:
                _UpperCAmelCase							:  Optional[Any]											=    mid
            _UpperCAmelCase							:  str											=    start + (end - start) / 2.0
        return mid





def  lowerCamelCase_						(UpperCamelCase__		:		float							):
    return x**3 - 2 * x - 5


if __name__ == "__main__":
  print(bisection(f, 1, 1_000))

  import doctest

  doctest.testmod()







"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowerCAmelCase    :int     =					logging.get_logger(__name__)

_lowerCAmelCase    :Union[str, Any]     =					{
    'alibaba-damo/mgp-str-base': 'https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json',
}
class 							_UpperCAmelCase							( a      ):





     '''simple docstring'''



     a__									='''mgp-str'''





     def __init__(					self       ,	A=[3_2, 1_2_8]       ,	A=4       ,	A=3       ,	A=2_7       ,	A=3_8       ,	A=5_0_2_5_7       ,	A=3_0_5_2_2       ,	A=7_6_8       ,	A=1_2       ,	A=1_2       ,	A=4.0       ,	A=True       ,	A=False       ,	A=1E-5       ,	A=0.0       ,	A=0.0       ,	A=0.0       ,	A=False       ,	A=0.02       ,	**A       ,	)							->					Union[str, Any]:
         super().__init__(**A		)

         _UpperCAmelCase							:  Any											=    image_size
         _UpperCAmelCase							:  str											=    patch_size
         _UpperCAmelCase							:  Dict											=    num_channels
         _UpperCAmelCase							:  Dict											=    max_token_length
         _UpperCAmelCase							:  Optional[Any]											=    num_character_labels
         _UpperCAmelCase							:  int											=    num_bpe_labels
         _UpperCAmelCase							:  List[str]											=    num_wordpiece_labels
         _UpperCAmelCase							:  Optional[int]											=    hidden_size
         _UpperCAmelCase							:  Any											=    num_hidden_layers
         _UpperCAmelCase							:  List[Any]											=    num_attention_heads
         _UpperCAmelCase							:  List[Any]											=    mlp_ratio
         _UpperCAmelCase							:  List[str]											=    distilled
         _UpperCAmelCase							:  Optional[int]											=    layer_norm_eps
         _UpperCAmelCase							:  str											=    drop_rate
         _UpperCAmelCase							:  List[Any]											=    qkv_bias
         _UpperCAmelCase							:  List[str]											=    attn_drop_rate
         _UpperCAmelCase							:  Dict											=    drop_path_rate
         _UpperCAmelCase							:  Union[str, Any]											=    output_aa_attentions
         _UpperCAmelCase							:  List[str]											=    initializer_range


