



"""simple docstring"""




import warnings
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


_lowerCAmelCase							:   List[str]				=				logging.get_logger(__name__)

_lowerCAmelCase							:   Tuple				=				{
    "nvidia/segformer-b0-finetuned-ade-512-512": (
        "https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/resolve/main/config.json"
    ),
    # See all SegFormer models at https://huggingface.co/models?filter=segformer
}






class       UpperCAmelCase_    (							_UpperCamelCase		):
      __SCREAMING_SNAKE_CASE		:  Optional[Any]						=					'segformer'



      def __init__(	self	:      Dict	,      A	:      List[Any]=3	,      A	:      Union[str, Any]=4	,      A	:      Tuple=[2, 2, 2, 2]	,      A	:      Union[str, Any]=[8, 4, 2, 1]	,      A	:      Union[str, Any]=[3_2, 6_4, 1_6_0, 2_5_6]	,      A	:      List[Any]=[7, 3, 3, 3]	,      A	:      Optional[Any]=[4, 2, 2, 2]	,      A	:      Tuple=[1, 2, 5, 8]	,      A	:      str=[4, 4, 4, 4]	,      A	:      int="gelu"	,      A	:      Any=0.0	,      A	:      Tuple=0.0	,      A	:      List[Any]=0.1	,      A	:      Tuple=0.02	,      A	:      str=0.1	,      A	:      Tuple=1e-6	,      A	:      Union[str, Any]=2_5_6	,      A	:      Union[str, Any]=2_5_5	,      **A	:      int	,      ):
           super().__init__(**A		)

           if "reshape_last_stage" in kwargs and kwargs["reshape_last_stage"] is False:
                warnings.warn(
                    "Reshape_last_stage is set to False in this config. This argument is deprecated and will soon be"
                    " removed, as the behaviour will default to that of reshape_last_stage = True."	,      A	,      )

           _UpperCAmelCase     :      Dict														=       num_channels
           _UpperCAmelCase     :      str														=       num_encoder_blocks
           _UpperCAmelCase     :      List[Any]														=       depths
           _UpperCAmelCase     :      Optional[int]														=       sr_ratios
           _UpperCAmelCase     :      Optional[Any]														=       hidden_sizes
           _UpperCAmelCase     :      Optional[int]														=       patch_sizes
           _UpperCAmelCase     :      str														=       strides
           _UpperCAmelCase     :      Optional[int]														=       mlp_ratios
           _UpperCAmelCase     :      List[str]														=       num_attention_heads
           _UpperCAmelCase     :      List[str]														=       hidden_act
           _UpperCAmelCase     :      int														=       hidden_dropout_prob
           _UpperCAmelCase     :      List[str]														=       attention_probs_dropout_prob
           _UpperCAmelCase     :      List[str]														=       classifier_dropout_prob
           _UpperCAmelCase     :      Tuple														=       initializer_range
           _UpperCAmelCase     :      List[Any]														=       drop_path_rate
           _UpperCAmelCase     :      List[str]														=       layer_norm_eps
           _UpperCAmelCase     :      Tuple														=       decoder_hidden_size
           _UpperCAmelCase     :      Tuple														=       kwargs.get("reshape_last_stage"	,      A		)
           _UpperCAmelCase     :      Optional[Any]														=       semantic_loss_ignore_index







class       UpperCAmelCase_    (							_UpperCamelCase		):
      __SCREAMING_SNAKE_CASE		:  str						=					version.parse('1.11'		)



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



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



      @property
      def 		snake_case_   (	self	:      List[str]		):
           return 1_2





"""simple docstring"""




def 		__snake_case		( SCREAMING_SNAKE_CASE__      :		str							)    ->  bool:





     '''simple docstring'''

     _UpperCAmelCase     :      str														=       0
     for ch in input_str:
          _UpperCAmelCase     :      Optional[int]														=       ord(SCREAMING_SNAKE_CASE__							)
          _UpperCAmelCase     :      int														=       pow(2		,    SCREAMING_SNAKE_CASE__							)

          # If we already turned on bit for current character's unicode
          if bitmap >> ch_unicode & 1 == 1:
               return False
          bitmap |= ch_bit_index_on
     return True


if __name__ == "__main__":
 import doctest

 doctest.testmod()
