






"""simple docstring"""







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	     =    logging.get_logger(__name__)

_UpperCamelCase	     =    {
    """facebook/data2vec-vision-base-ft""": (
        """https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json"""
    ),
}







class    lowerCamelCase__   (			snake_case					):
    SCREAMING_SNAKE_CASE						=     "data2vec-vision"






    def __init__(					self      ,A=768      ,A=12      ,A=12      ,A=3_072      ,A="gelu"      ,A=0.0      ,A=0.0      ,A=0.02      ,A=1e-1_2      ,A=224      ,A=16      ,A=3      ,A=False      ,A=False      ,A=False      ,A=False      ,A=0.1      ,A=0.1      ,A=True      ,A=[3, 5, 7, 11]      ,A=[1, 2, 3, 6]      ,A=True      ,A=0.4      ,A=256      ,A=1      ,A=False      ,A=255      ,**A      ,):
          super().__init__(**snake_case__   )

          UpperCAmelCase							     =			hidden_size
          UpperCAmelCase							     =			num_hidden_layers
          UpperCAmelCase							     =			num_attention_heads
          UpperCAmelCase							     =			intermediate_size
          UpperCAmelCase							     =			hidden_act
          UpperCAmelCase							     =			hidden_dropout_prob
          UpperCAmelCase							     =			attention_probs_dropout_prob
          UpperCAmelCase							     =			initializer_range
          UpperCAmelCase							     =			layer_norm_eps

          UpperCAmelCase							     =			image_size
          UpperCAmelCase							     =			patch_size
          UpperCAmelCase							     =			num_channels
          UpperCAmelCase							     =			use_mask_token
          UpperCAmelCase							     =			use_absolute_position_embeddings
          UpperCAmelCase							     =			use_relative_position_bias
          UpperCAmelCase							     =			use_shared_relative_position_bias
          UpperCAmelCase							     =			layer_scale_init_value
          UpperCAmelCase							     =			drop_path_rate
          UpperCAmelCase							     =			use_mean_pooling
          # decode head attributes (semantic segmentation)
          UpperCAmelCase							     =			out_indices
          UpperCAmelCase							     =			pool_scales
          # auxiliary head attributes (semantic segmentation)
          UpperCAmelCase							     =			use_auxiliary_head
          UpperCAmelCase							     =			auxiliary_loss_weight
          UpperCAmelCase							     =			auxiliary_channels
          UpperCAmelCase							     =			auxiliary_num_convs
          UpperCAmelCase							     =			auxiliary_concat_input
          UpperCAmelCase							     =			semantic_loss_ignore_index







class    lowerCamelCase__   (			snake_case					):
    SCREAMING_SNAKE_CASE						=     version.parse('''1.11'''					)






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






    @property
    def 							_UpperCamelCase				(					self   ):
          return 1e-4





'''simple docstring'''





SCREAMING_SNAKE_CASE     =       {
    """meter""": """m""",
    """kilometer""": """km""",
    """megametre""": """Mm""",
    """gigametre""": """Gm""",
    """terametre""": """Tm""",
    """petametre""": """Pm""",
    """exametre""": """Em""",
    """zettametre""": """Zm""",
    """yottametre""": """Ym""",
}
# Exponent of the factor(meter)
SCREAMING_SNAKE_CASE     =       {
    """m""": 0,
    """km""": 3,
    """Mm""": 6,
    """Gm""": 9,
    """Tm""": 1_2,
    """Pm""": 1_5,
    """Em""": 1_8,
    """Zm""": 2_1,
    """Ym""": 2_4,
}







def snake_case_     (					lowercase__   ,       lowercase__   ,       lowercase__		):
  UpperCAmelCase__      :					str				       =							from_type.lower().strip("s"		)
  UpperCAmelCase__      :					Any				       =							to_type.lower().strip("s"		)

  UpperCAmelCase__      :					Union[str, Any]				       =							UNIT_SYMBOL.get(lowercase__   ,       lowercase__		)
  UpperCAmelCase__      :					Any				       =							UNIT_SYMBOL.get(lowercase__   ,       lowercase__		)

  if from_sanitized not in METRIC_CONVERSION:
    UpperCAmelCase__      :					str				       =							(
        F"""Invalid 'from_type' value: {from_type!r}.\n"""
        F"""Conversion abbreviations are: {", ".join(lowercase__		)}"""
    )
    raise ValueError(lowercase__		)
  if to_sanitized not in METRIC_CONVERSION:
    UpperCAmelCase__      :					List[str]				       =							(
        F"""Invalid 'to_type' value: {to_type!r}.\n"""
        F"""Conversion abbreviations are: {", ".join(lowercase__		)}"""
    )
    raise ValueError(lowercase__		)
  UpperCAmelCase__      :					Optional[int]				       =							METRIC_CONVERSION[from_sanitized]
  UpperCAmelCase__      :					str				       =							METRIC_CONVERSION[to_sanitized]
  UpperCAmelCase__      :					Tuple				       =							1

  if from_exponent > to_exponent:
    UpperCAmelCase__      :					Tuple				       =							from_exponent - to_exponent
  else:
    UpperCAmelCase__      :					Optional[int]				       =							-(to_exponent - from_exponent)

  return value * pow(1_0   ,       lowercase__		)


if __name__ == "__main__":
      from doctest import testmod

      testmod()



