


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
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_snake_case             =     logging.get_logger(__name__)

_snake_case             =     {
    '''microsoft/swin-tiny-patch4-window7-224''': (
        '''https://huggingface.co/microsoft/swin-tiny-patch4-window7-224/resolve/main/config.json'''
    ),
    # See all Swin models at https://huggingface.co/models?filter=swin
}
class 	UpperCAmelCase_					(					UpperCamelCase		, UpperCamelCase    ):

   '''simple docstring'''




   __A :      int     		=		"swin"

   __A :      List[str]     		=		{
       "num_attention_heads": "num_heads",
       "num_hidden_layers": "num_layers",
   }






   def __init__(		self						,				__A=224						,				__A=4						,				__A=3						,				__A=96						,				__A=[2, 2, 6, 2]						,				__A=[3, 6, 12, 24]						,				__A=7						,				__A=4.0						,				__A=True						,				__A=0.0						,				__A=0.0						,				__A=0.1						,				__A="gelu"						,				__A=False						,				__A=0.02						,				__A=1e-5						,				__A=32						,				__A=None						,				__A=None						,				**__A						,				):






     """simple docstring"""





     super().__init__(**__A )

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



class 	UpperCAmelCase_					(					UpperCamelCase    ):

   '''simple docstring'''




   __A :      str     		=		version.parse("1.11"    )






   @property
   def _snake_case    (		self ):






     """simple docstring"""





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






   @property
   def _snake_case    (		self ):






     """simple docstring"""





     return 1e-4







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


_snake_case             =     logging.get_logger(__name__)

_snake_case             =     {
    '''google/mobilenet_v2_1.4_224''': '''https://huggingface.co/google/mobilenet_v2_1.4_224/resolve/main/config.json''',
    '''google/mobilenet_v2_1.0_224''': '''https://huggingface.co/google/mobilenet_v2_1.0_224/resolve/main/config.json''',
    '''google/mobilenet_v2_0.75_160''': '''https://huggingface.co/google/mobilenet_v2_0.75_160/resolve/main/config.json''',
    '''google/mobilenet_v2_0.35_96''': '''https://huggingface.co/google/mobilenet_v2_0.35_96/resolve/main/config.json''',
    # See all MobileNetV2 models at https://huggingface.co/models?filter=mobilenet_v2
}
class 	UpperCAmelCase_					(					UpperCamelCase    ):

   '''simple docstring'''




   __A :      Dict     		=		"mobilenet_v2"






   def __init__(		self						,				__A=3						,				__A=224						,				__A=1.0						,				__A=8						,				__A=8						,				__A=6						,				__A=32						,				__A=True						,				__A=True						,				__A="relu6"						,				__A=True						,				__A=0.8						,				__A=0.02						,				__A=0.001						,				__A=255						,				**__A						,				):






     """simple docstring"""





     super().__init__(**__A )

     if depth_multiplier <= 0:
       raise ValueError("depth_multiplier must be greater than zero." )

     lowerCamelCase :					str    =				num_channels
     lowerCamelCase :					Any    =				image_size
     lowerCamelCase :					Union[str, Any]    =				depth_multiplier
     lowerCamelCase :					Tuple    =				depth_divisible_by
     lowerCamelCase :					Dict    =				min_depth
     lowerCamelCase :					Dict    =				expand_ratio
     lowerCamelCase :					Optional[Any]    =				output_stride
     lowerCamelCase :					int    =				first_layer_is_expansion
     lowerCamelCase :					Union[str, Any]    =				finegrained_output
     lowerCamelCase :					Optional[Any]    =				hidden_act
     lowerCamelCase :					Optional[Any]    =				tf_padding
     lowerCamelCase :					Optional[Any]    =				classifier_dropout_prob
     lowerCamelCase :					Dict    =				initializer_range
     lowerCamelCase :					str    =				layer_norm_eps
     lowerCamelCase :					Optional[Any]    =				semantic_loss_ignore_index



class 	UpperCAmelCase_					(					UpperCamelCase    ):

   '''simple docstring'''




   __A :      Union[str, Any]     		=		version.parse("1.11"    )






   @property
   def _snake_case    (		self ):






     """simple docstring"""





     return OrderedDict([("pixel_values", {0: "batch"})] )






   @property
   def _snake_case    (		self ):






     """simple docstring"""





     if self.task == "image-classification":
       return OrderedDict([("logits", {0: "batch"})] )
     else:
       return OrderedDict([("last_hidden_state", {0: "batch"}), ("pooler_output", {0: "batch"})] )






   @property
   def _snake_case    (		self ):






     """simple docstring"""





     return 1e-4



