




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


SCREAMING_SNAKE_CASE_	     =       logging.get_logger(__name__)

SCREAMING_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 				snake_case_			(					lowerCamelCase_	, lowerCamelCase_			):







   """simple docstring"""




   A_				      =       '''swin'''

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







   def __init__(		self       ,					lowerCamelCase_=2_2_4       ,					lowerCamelCase_=4       ,					lowerCamelCase_=3       ,					lowerCamelCase_=9_6       ,					lowerCamelCase_=[2, 2, 6, 2]       ,					lowerCamelCase_=[3, 6, 1_2, 2_4]       ,					lowerCamelCase_=7       ,					lowerCamelCase_=4.0       ,					lowerCamelCase_=True       ,					lowerCamelCase_=0.0       ,					lowerCamelCase_=0.0       ,					lowerCamelCase_=0.1       ,					lowerCamelCase_="gelu"       ,					lowerCamelCase_=False       ,					lowerCamelCase_=0.02       ,					lowerCamelCase_=1e-5       ,					lowerCamelCase_=3_2       ,					lowerCamelCase_=None       ,					lowerCamelCase_=None       ,					**lowerCamelCase_       ,					)				->   Any:
       super().__init__(**lowerCamelCase_)

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

class 				snake_case_			(					lowerCamelCase_			):







   """simple docstring"""




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







   @property
   def   UpperCAmelCase__			(		self)				->   Mapping[str, Mapping[int, str]]:
       return OrderedDict(
           [
               ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
           ])







   @property
   def   UpperCAmelCase__			(		self)				->   float:
       return 1e-4





"""simple docstring"""

from typing import TYPE_CHECKING

from ..utils import _LazyModule


a							      =     {
    '''config''': [
        '''EXTERNAL_DATA_FORMAT_SIZE_LIMIT''',
        '''OnnxConfig''',
        '''OnnxConfigWithPast''',
        '''OnnxSeq2SeqConfigWithPast''',
        '''PatchingSpec''',
    ],
    '''convert''': ['''export''', '''validate_model_outputs'''],
    '''features''': ['''FeaturesManager'''],
    '''utils''': ['''ParameterFormat''', '''compute_serialized_parameters_size'''],
}


if TYPE_CHECKING:
       from .config import (
           EXTERNAL_DATA_FORMAT_SIZE_LIMIT,
           OnnxConfig,
           OnnxConfigWithPast,
           OnnxSeqaSeqConfigWithPast,
           PatchingSpec,
       )
       from .convert import export, validate_model_outputs
       from .features import FeaturesManager
       from .utils import ParameterFormat, compute_serialized_parameters_size

else:
       import sys

       a							      =     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

