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


_a      :		Optional[int]           =   logging.get_logger(__name__)

_a      :		Tuple           =   {
    'sail/poolformer_s12': 'https://huggingface.co/sail/poolformer_s12/resolve/main/config.json',
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
}
class 						__A							( SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:			Union[str, Any]							=		"poolformer"






     def __init__(		self				,     a__=3				,     a__=16				,     a__=16				,     a__=3				,     a__=4.0				,     a__=[2, 2, 6, 2]				,     a__=[64, 128, 320, 512]				,     a__=[7, 3, 3, 3]				,     a__=[4, 2, 2, 2]				,     a__=[2, 1, 1, 1]				,     a__=4				,     a__=0.0				,     a__="gelu"				,     a__=True				,     a__=1e-5				,     a__=0.0_2				,     **a__				,     ):
       _lowerCAmelCase						:       List[Any]  			=     num_channels
       _lowerCAmelCase						:       str  			=     patch_size
       _lowerCAmelCase						:       Dict  			=     stride
       _lowerCAmelCase						:       Optional[int]  			=     padding
       _lowerCAmelCase						:       Optional[int]  			=     pool_size
       _lowerCAmelCase						:       Dict  			=     hidden_sizes
       _lowerCAmelCase						:       Optional[int]  			=     mlp_ratio
       _lowerCAmelCase						:       Optional[int]  			=     depths
       _lowerCAmelCase						:       Dict  			=     patch_sizes
       _lowerCAmelCase						:       Tuple  			=     strides
       _lowerCAmelCase						:       Any  			=     num_encoder_blocks
       _lowerCAmelCase						:       Any  			=     drop_path_rate
       _lowerCAmelCase						:       Tuple  			=     hidden_act
       _lowerCAmelCase						:       Optional[Any]  			=     use_layer_scale
       _lowerCAmelCase						:       List[str]  			=     layer_scale_init_value
       _lowerCAmelCase						:       List[Any]  			=     initializer_range
       super().__init__(**a__  )







class 						__A							( SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:			Optional[Any]							=		version.parse("1.11"		)






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






     @property
     def     __A  (		self  ):
       return 2e-3






'''simple docstring'''







from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_lowercase :  int    							=       logging.get_logger(__name__)

_lowercase :  List[Any]    							=       {
    "shi-labs/nat-mini-in1k-224": "https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json",
    # See all Nat models at https://huggingface.co/models?filter=nat
}






class  lowerCAmelCase__   (  lowerCamelCase_    ,						lowerCamelCase_     ):
					lowerCAmelCase_        =     '''nat'''

					lowerCAmelCase_        =     {
					    '''num_attention_heads''': '''num_heads''',
					    '''num_hidden_layers''': '''num_layers''',
					}






					def __init__(   self				,							__SCREAMING_SNAKE_CASE=4				,							__SCREAMING_SNAKE_CASE=3				,							__SCREAMING_SNAKE_CASE=64				,							__SCREAMING_SNAKE_CASE=[3, 4, 6, 5]				,							__SCREAMING_SNAKE_CASE=[2, 4, 8, 16]				,							__SCREAMING_SNAKE_CASE=7				,							__SCREAMING_SNAKE_CASE=3.0				,							__SCREAMING_SNAKE_CASE=True				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=0.1				,							__SCREAMING_SNAKE_CASE="gelu"				,							__SCREAMING_SNAKE_CASE=0.02				,							__SCREAMING_SNAKE_CASE=1E-5				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=None				,							__SCREAMING_SNAKE_CASE=None				,							**__SCREAMING_SNAKE_CASE				,							):


											"""simple docstring"""





											super().__init__(**__SCREAMING_SNAKE_CASE		)

											lowercase_	:     Optional[int]													=       patch_size
											lowercase_	:     List[Any]													=       num_channels
											lowercase_	:     str													=       embed_dim
											lowercase_	:     List[str]													=       depths
											lowercase_	:     str													=       len(__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Tuple													=       num_heads
											lowercase_	:     int													=       kernel_size
											lowercase_	:     Union[str, Any]													=       mlp_ratio
											lowercase_	:     Optional[int]													=       qkv_bias
											lowercase_	:     List[Any]													=       hidden_dropout_prob
											lowercase_	:     Optional[int]													=       attention_probs_dropout_prob
											lowercase_	:     List[Any]													=       drop_path_rate
											lowercase_	:     List[Any]													=       hidden_act
											lowercase_	:     int													=       layer_norm_eps
											lowercase_	:     int													=       initializer_range
											# we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
											# this indicates the channel dimension after the last stage of the model
											lowercase_	:     Dict													=       int(embed_dim * 2 ** (len(__SCREAMING_SNAKE_CASE		) - 1)		)
											lowercase_	:     Tuple													=       layer_scale_init_value
											lowercase_	:     Union[str, Any]													=       ['''stem'''] + [F'''stage{idx}''' for idx in range(1				,							len(__SCREAMING_SNAKE_CASE		) + 1		)]
											lowercase_						, lowercase_	:     int													=       get_aligned_output_features_output_indices(
											    out_features=__SCREAMING_SNAKE_CASE				,							out_indices=__SCREAMING_SNAKE_CASE				,							stage_names=self.stage_names		)



