





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

__lowerCAmelCase				:      Dict						      ={
    "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__							):
 __lowercase  						=							"""segformer"""
 def __init__(							self :int		,			lowercase_ :str=3		,			lowercase_ :List[str]=4		,			lowercase_ :Dict=[2, 2, 2, 2]		,			lowercase_ :int=[8, 4, 2, 1]		,			lowercase_ :Any=[32, 64, 1_60, 2_56]		,			lowercase_ :Any=[7, 3, 3, 3]		,			lowercase_ :Union[str, Any]=[4, 2, 2, 2]		,			lowercase_ :Tuple=[1, 2, 5, 8]		,			lowercase_ :Any=[4, 4, 4, 4]		,			lowercase_ :Union[str, Any]="gelu"		,			lowercase_ :Dict=0.0		,			lowercase_ :Union[str, Any]=0.0		,			lowercase_ :Tuple=0.1		,			lowercase_ :Tuple=0.0_2		,			lowercase_ :Tuple=0.1		,			lowercase_ :List[Any]=1E-6		,			lowercase_ :Union[str, Any]=2_56		,			lowercase_ :List[Any]=2_55		,			**lowercase_ :Union[str, Any]		,			)->				List[str]:
     super().__init__(**lowercase_				)

     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."		,			lowercase_		,			)

     A__							=     num_channels
     A__							=     num_encoder_blocks
     A__							=     depths
     A__							=     sr_ratios
     A__							=     hidden_sizes
     A__							=     patch_sizes
     A__							=     strides
     A__							=     mlp_ratios
     A__							=     num_attention_heads
     A__							=     hidden_act
     A__							=     hidden_dropout_prob
     A__							=     attention_probs_dropout_prob
     A__							=     classifier_dropout_prob
     A__							=     initializer_range
     A__							=     drop_path_rate
     A__							=     layer_norm_eps
     A__							=     decoder_hidden_size
     A__							=     kwargs.get("reshape_last_stage"		,			lowercase_				)
     A__							=     semantic_loss_ignore_index






class   UpperCAmelCase      (			UpperCamelCase__							):
 __lowercase  						=							version.parse("""1.11"""							)
 @property
 def 	UpperCAmelCase_				(							self :List[str]				)->				Mapping[str, Mapping[int, str]]:
     return OrderedDict(
         [
             ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
         ]				)
 @property
 def 	UpperCAmelCase_				(							self :List[str]				)->				float:
     return 1E-4



 @property
 def 	UpperCAmelCase_				(							self :List[str]				)->				int:
     return 12










'''simple docstring'''

from string import ascii_uppercase

__lowerCAmelCase				:      Union[str, Any]						      ={str(ord(c) - 55): c for c in ascii_uppercase}





def 		UpperCamelCase							(				_lowerCamelCase   :   int		,			_lowerCamelCase   :   int			):
    if isinstance(_lowerCamelCase		,			_lowerCamelCase			):
        raise TypeError("int() can't convert non-string with explicit base"			)
    if num < 0:
        raise ValueError("parameter must be positive int"			)
    if isinstance(_lowerCamelCase		,			_lowerCamelCase			):
        raise TypeError("'str' object cannot be interpreted as an integer"			)
    if isinstance(_lowerCamelCase		,			_lowerCamelCase			):
        raise TypeError("'float' object cannot be interpreted as an integer"			)
    if base in (0, 1):
        raise ValueError("base must be >= 2"			)
    if base > 36:
        raise ValueError("base must be <= 36"			)
    A__							=     ""
    A__							=     0
    A__							=     0
    while div != 1:
        A__,      A__							=     divmod(_lowerCamelCase		,			_lowerCamelCase			)
        if base >= 11 and 9 < mod < 36:
            A__							=     ALPHABET_VALUES[str(_lowerCamelCase			)]
        else:
            A__							=     str(_lowerCamelCase			)
        new_value += actual_value
        A__							=     num // base
        A__							=     div
        if div == 0:
            return str(new_value[::-1]			)
        elif div == 1:
            new_value += str(_lowerCamelCase			)
            return str(new_value[::-1]			)

    return new_value[::-1]


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  for base in range(2, 37):
    for num in range(1000):
      assert int(decimal_to_any(num, base), base) == num, (
          num,
          base,
          decimal_to_any(num, base),
          int(decimal_to_any(num, base), base),
      )



