




from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_UpperCAmelCase	:						Any			=     logging.get_logger(__name__)

_UpperCAmelCase	:						Optional[Any]			=     {
    "microsoft/beit-base-patch16-224-pt22k": (
        "https://huggingface.co/microsoft/beit-base-patch16-224-pt22k/resolve/main/config.json"
    ),
    # See all BEiT models at https://huggingface.co/models?filter=beit
}




class    __lowerCAmelCase       (							lowerCAmelCase):
       _a 					=						'''beit'''






       def __init__(   self:					int       ,					_lowerCAmelCase:					Dict=81_92       ,					_lowerCAmelCase:					Optional[Any]=7_68       ,					_lowerCAmelCase:					Tuple=12       ,					_lowerCAmelCase:					List[Any]=12       ,					_lowerCAmelCase:					Tuple=30_72       ,					_lowerCAmelCase:					Tuple="gelu"       ,					_lowerCAmelCase:					Tuple=0.0       ,					_lowerCAmelCase:					Any=0.0       ,					_lowerCAmelCase:					Tuple=0.02       ,					_lowerCAmelCase:					Union[str, Any]=1e-1_2       ,					_lowerCAmelCase:					Dict=2_24       ,					_lowerCAmelCase:					int=16       ,					_lowerCAmelCase:					Tuple=3       ,					_lowerCAmelCase:					List[Any]=False       ,					_lowerCAmelCase:					int=False       ,					_lowerCAmelCase:					Any=False       ,					_lowerCAmelCase:					List[Any]=False       ,					_lowerCAmelCase:					int=0.1       ,					_lowerCAmelCase:					List[Any]=0.1       ,					_lowerCAmelCase:					Optional[int]=True       ,					_lowerCAmelCase:					Optional[Any]=[3, 5, 7, 11]       ,					_lowerCAmelCase:					Any=[1, 2, 3, 6]       ,					_lowerCAmelCase:					Dict=True       ,					_lowerCAmelCase:					List[str]=0.4       ,					_lowerCAmelCase:					Union[str, Any]=2_56       ,					_lowerCAmelCase:					List[str]=1       ,					_lowerCAmelCase:					Optional[Any]=False       ,					_lowerCAmelCase:					List[Any]=2_55       ,					**_lowerCAmelCase:					str       ,					):
         super().__init__(**_lowerCAmelCase				)

         lowercase    :str      	=						vocab_size
         lowercase    :Optional[int]      	=						hidden_size
         lowercase    :Dict      	=						num_hidden_layers
         lowercase    :Optional[Any]      	=						num_attention_heads
         lowercase    :Any      	=						intermediate_size
         lowercase    :Any      	=						hidden_act
         lowercase    :str      	=						hidden_dropout_prob
         lowercase    :Any      	=						attention_probs_dropout_prob
         lowercase    :Optional[Any]      	=						initializer_range
         lowercase    :Dict      	=						layer_norm_eps

         lowercase    :Optional[int]      	=						image_size
         lowercase    :List[str]      	=						patch_size
         lowercase    :Union[str, Any]      	=						num_channels
         lowercase    :Tuple      	=						use_mask_token
         lowercase    :Optional[Any]      	=						use_absolute_position_embeddings
         lowercase    :Tuple      	=						use_relative_position_bias
         lowercase    :Union[str, Any]      	=						use_shared_relative_position_bias
         lowercase    :Optional[Any]      	=						layer_scale_init_value
         lowercase    :Optional[int]      	=						drop_path_rate
         lowercase    :Union[str, Any]      	=						use_mean_pooling
         # decode head attributes (semantic segmentation)
         lowercase    :Optional[Any]      	=						out_indices
         lowercase    :str      	=						pool_scales
         # auxiliary head attributes (semantic segmentation)
         lowercase    :str      	=						use_auxiliary_head
         lowercase    :Tuple      	=						auxiliary_loss_weight
         lowercase    :int      	=						auxiliary_channels
         lowercase    :str      	=						auxiliary_num_convs
         lowercase    :List[Any]      	=						auxiliary_concat_input
         lowercase    :List[str]      	=						semantic_loss_ignore_index







class    __lowerCAmelCase       (							lowerCAmelCase):
       _a 					=						version.parse('''1.11''')






       @property
       def 					SCREAMING_SNAKE_CASE    (   self:					int				):
         return OrderedDict(
             [
                 ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
             ]				)






       @property
       def 					SCREAMING_SNAKE_CASE    (   self:					List[str]				):
         return 1e-4









def       UpperCAmelCase__  (     lowerCamelCase   ):
  return 10 - x * x



def       UpperCAmelCase__  (     lowerCamelCase,			lowerCamelCase   ):
  # Bolzano theory in order to find if there is a root between a and b
  if equation(lowerCamelCase   ) * equation(lowerCamelCase   ) >= 0:
    raise ValueError("Wrong space!"   )

  lowercase    :Optional[int]      	=						a
  while (b - a) >= 0.01:
    # Find middle point
    lowercase    :Optional[Any]      	=						(a + b) / 2
    # Check if middle point is root
    if equation(lowerCamelCase   ) == 0.0:
      break
    # Decide the side to repeat the steps
    if equation(lowerCamelCase   ) * equation(lowerCamelCase   ) < 0:
      lowercase    :Any      	=						c
    else:
      lowercase    :List[Any]      	=						c
  return c


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     print(bisection(-2, 5))
     print(bisection(0, 6))



