






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


UpperCamelCase 				=	logging.get_logger(__name__)

UpperCamelCase 				=	{
    "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		(__lowerCamelCase       ,__lowerCamelCase    ):
			__snake_case				:      List[str] 						=							"swin"

			__snake_case				:      Optional[Any] 						=							{
			    "num_attention_heads": "num_heads",
			    "num_hidden_layers": "num_layers",
			}







			def __init__(	self:  Optional[Any]      ,	UpperCAmelCase_:  List[Any]=224      ,	UpperCAmelCase_:  Union[str, Any]=4      ,	UpperCAmelCase_:  List[str]=3      ,	UpperCAmelCase_:  str=96      ,	UpperCAmelCase_:  int=[2, 2, 6, 2]      ,	UpperCAmelCase_:  Dict=[3, 6, 12, 24]      ,	UpperCAmelCase_:  str=7      ,	UpperCAmelCase_:  Any=4.0      ,	UpperCAmelCase_:  Optional[Any]=True      ,	UpperCAmelCase_:  List[str]=0.0      ,	UpperCAmelCase_:  Optional[int]=0.0      ,	UpperCAmelCase_:  Any=0.1      ,	UpperCAmelCase_:  List[str]="gelu"      ,	UpperCAmelCase_:  Optional[Any]=False      ,	UpperCAmelCase_:  List[Any]=0.02      ,	UpperCAmelCase_:  List[str]=1E-5      ,	UpperCAmelCase_:  Any=32      ,	UpperCAmelCase_:  Tuple=None      ,	UpperCAmelCase_:  Dict=None      ,	**UpperCAmelCase_:  Optional[int]      ,	):







									'''simple docstring'''




									super().__init__(**UpperCAmelCase_     )

									_SCREAMING_SNAKE_CASE	      =  image_size
									_SCREAMING_SNAKE_CASE	      =  patch_size
									_SCREAMING_SNAKE_CASE	      =  num_channels
									_SCREAMING_SNAKE_CASE	      =  embed_dim
									_SCREAMING_SNAKE_CASE	      =  depths
									_SCREAMING_SNAKE_CASE	      =  len(UpperCAmelCase_     )
									_SCREAMING_SNAKE_CASE	      =  num_heads
									_SCREAMING_SNAKE_CASE	      =  window_size
									_SCREAMING_SNAKE_CASE	      =  mlp_ratio
									_SCREAMING_SNAKE_CASE	      =  qkv_bias
									_SCREAMING_SNAKE_CASE	      =  hidden_dropout_prob
									_SCREAMING_SNAKE_CASE	      =  attention_probs_dropout_prob
									_SCREAMING_SNAKE_CASE	      =  drop_path_rate
									_SCREAMING_SNAKE_CASE	      =  hidden_act
									_SCREAMING_SNAKE_CASE	      =  use_absolute_embeddings
									_SCREAMING_SNAKE_CASE	      =  layer_norm_eps
									_SCREAMING_SNAKE_CASE	      =  initializer_range
									_SCREAMING_SNAKE_CASE	      =  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
									_SCREAMING_SNAKE_CASE	      =  int(embed_dim * 2 ** (len(UpperCAmelCase_     ) - 1)     )
									_SCREAMING_SNAKE_CASE	      =  ["""stem"""] + [F'stage{idx}' for idx in range(1      ,	len(UpperCAmelCase_     ) + 1     )]
									_SCREAMING_SNAKE_CASE	      =  get_aligned_output_features_output_indices(
									    out_features=UpperCAmelCase_      ,	out_indices=UpperCAmelCase_      ,	stage_names=self.stage_names     )



class       __UpperCAmelCase		(__lowerCamelCase    ):
			__snake_case				:      Dict 						=							version.parse("1.11"    )







			@property
			def 							UpperCamelCase      (	self:  Tuple     ):







									'''simple docstring'''




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







			@property
			def 							UpperCamelCase      (	self:  List[Any]     ):







									'''simple docstring'''




									return 1E-4








__UpperCAmelCase       :   int				       =							[
    "Audio",
    "Array2D",
    "Array3D",
    "Array4D",
    "Array5D",
    "ClassLabel",
    "Features",
    "Sequence",
    "Value",
    "Image",
    "Translation",
    "TranslationVariableLanguages",
]
from .audio import Audio
from .features import ArrayaD, ArrayaD, ArrayaD, ArrayaD, ClassLabel, Features, Sequence, Value
from .image import Image
from .translation import Translation, TranslationVariableLanguages






