



"""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       :					Optional[int]      					=					logging.get_logger(__name__)

__lowerCAmelCase       :					int      					=					{
    '''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    _lowerCAmelCase    (				snake_case__		):





		"""simple docstring"""






		_lowerCamelCase			  =       '''segformer'''





		def __init__(					self							,    _lowercase=3							,    _lowercase=4							,    _lowercase=[2, 2, 2, 2]							,    _lowercase=[8, 4, 2, 1]							,    _lowercase=[3_2, 6_4, 1_6_0, 2_5_6]							,    _lowercase=[7, 3, 3, 3]							,    _lowercase=[4, 2, 2, 2]							,    _lowercase=[1, 2, 5, 8]							,    _lowercase=[4, 4, 4, 4]							,    _lowercase="gelu"							,    _lowercase=0.0							,    _lowercase=0.0							,    _lowercase=0.1							,    _lowercase=0.02							,    _lowercase=0.1							,    _lowercase=1E-6							,    _lowercase=2_5_6							,    _lowercase=2_5_5							,    **_lowercase							,    ) ->						List[Any]:







								'''simple docstring'''

								super().__init__(**_SCREAMING_SNAKE_CASE   )

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

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




class    _lowerCAmelCase    (				snake_case__		):





		"""simple docstring"""






		_lowerCamelCase			  =       version.parse('''1.11'''		)





		@property
		def    UpperCAmelCase__							(					self   ) ->						Mapping[str, Mapping[int, str]]:







								'''simple docstring'''

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





		@property
		def    UpperCAmelCase__							(					self   ) ->						float:







								'''simple docstring'''

								return 1E-4





		@property
		def    UpperCAmelCase__							(					self   ) ->						int:







								'''simple docstring'''

								return 1_2






"""simple docstring"""





def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						if a < 0 or b < 0:
												raise ValueError("""the value of both inputs must be positive"""    )

						snake_case_   : List[str]						=			str(bin(__UpperCamelCase    )    )[2:]  # remove the leading "0b"
						snake_case_   : Union[str, Any]						=			str(bin(__UpperCamelCase    )    )[2:]  # remove the leading "0b"

						snake_case_   : int						=			max(len(__UpperCamelCase    )					, len(__UpperCamelCase    )    )

						return "0b" + "".join(
						    str(int(char_a != char_b    )    )
						    for char_a, char_b in zip(a_binary.zfill(__UpperCamelCase    )					, b_binary.zfill(__UpperCamelCase    )    )    )


if __name__ == "__main__":
					import doctest

					doctest.testmod()

