
"""simple docstring"""






def __magic_name__	(				_lowerCamelCase:		Tuple,					_lowerCamelCase:		Any			)					->						Optional[Any]:

	'''simple docstring'''




	lowerCAmelCase												=  [1]
	for i in range(2,					_lowerCamelCase			):
		factorials.append(factorials[-1] * i			)
	assert 0 <= k < factorials[-1] * n, "k out of bounds"

	lowerCAmelCase												=  []
	lowerCAmelCase												=  list(range(_lowerCamelCase			)			)

	# Find permutation
	while factorials:
		lowerCAmelCase												=  factorials.pop()
		lowerCAmelCase							,       lowerCAmelCase												=  divmod(_lowerCamelCase,					_lowerCamelCase			)
		permutation.append(elements[number]			)
		elements.remove(elements[number]			)
	permutation.append(elements[0]			)

	return permutation


if __name__ == "__main__":
					import doctest

					doctest.testmod()




"""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


UpperCAmelCase        =				logging.get_logger(__name__)

UpperCAmelCase        =				{
    """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 			lowercase					( lowercase__		):
			lowercase        =     '''segformer'''






			def __init__(self  :	str      ,SCREAMING_SNAKE_CASE_  :	Optional[Any]=3      ,SCREAMING_SNAKE_CASE_  :	List[str]=4      ,SCREAMING_SNAKE_CASE_  :	Union[str, Any]=[2, 2, 2, 2]      ,SCREAMING_SNAKE_CASE_  :	List[str]=[8, 4, 2, 1]      ,SCREAMING_SNAKE_CASE_  :	int=[32, 64, 160, 256]      ,SCREAMING_SNAKE_CASE_  :	Optional[Any]=[7, 3, 3, 3]      ,SCREAMING_SNAKE_CASE_  :	Union[str, Any]=[4, 2, 2, 2]      ,SCREAMING_SNAKE_CASE_  :	List[Any]=[1, 2, 5, 8]      ,SCREAMING_SNAKE_CASE_  :	Dict=[4, 4, 4, 4]      ,SCREAMING_SNAKE_CASE_  :	Optional[int]="gelu"      ,SCREAMING_SNAKE_CASE_  :	Optional[Any]=0.0      ,SCREAMING_SNAKE_CASE_  :	Union[str, Any]=0.0      ,SCREAMING_SNAKE_CASE_  :	List[str]=0.1      ,SCREAMING_SNAKE_CASE_  :	List[Any]=0.02      ,SCREAMING_SNAKE_CASE_  :	str=0.1      ,SCREAMING_SNAKE_CASE_  :	Dict=1e-6      ,SCREAMING_SNAKE_CASE_  :	List[str]=256      ,SCREAMING_SNAKE_CASE_  :	List[str]=255      ,**SCREAMING_SNAKE_CASE_  :	Tuple      ,)       ->	int:





				"""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_      ,)

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





class 			lowercase					( lowercase__		):
			lowercase        =     version.parse('''1.11'''		)






			@property
			def 					UpperCAmelCase							(self  :	Union[str, Any]			)       ->	Mapping[str, Mapping[int, str]]:





				"""simple docstring"""


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






			@property
			def 					UpperCAmelCase							(self  :	str			)       ->	float:





				"""simple docstring"""


				return 1e-4






			@property
			def 					UpperCAmelCase							(self  :	Dict			)       ->	int:





				"""simple docstring"""


				return 12


