




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


snake_case 				=       logging.get_logger(__name__)





class 				A_				(      UpperCAmelCase					,	UpperCAmelCase	):







       """simple docstring"""





       SCREAMING_SNAKE_CASE_      : Tuple      =  '''maskformer-swin'''

       SCREAMING_SNAKE_CASE_      : int      =  {
           '''num_attention_heads''': '''num_heads''',
           '''num_hidden_layers''': '''num_layers''',
       }







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

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






from ....utils import logging


snake_case 				=       logging.get_logger(__name__)





class 				A_				(      UpperCAmelCase	):







       """simple docstring"""





       def __init__(    self	:	Union[str, Any]						,__A	:	int						,__A	:	List[Any]=None						,__A	:	List[str]=2048  )						->					List[Any]:
         _lowercase							= config.__dict__
         _lowercase							= modal_hidden_size
         if num_labels:
           _lowercase							= num_labels