



"""simple docstring"""







from collections import OrderedDict
from typing import List, Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowercase__				   =     logging.get_logger(__name__)

lowercase__				   =     {
    """google/efficientnet-b7""": """https://huggingface.co/google/efficientnet-b7/resolve/main/config.json""",
}







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""efficientnet"""



      def __init__(				self    :				List[Any]   ,      SCREAMING_SNAKE_CASE_    :				int = 3   ,      SCREAMING_SNAKE_CASE_    :				int = 6_0_0   ,      SCREAMING_SNAKE_CASE_    :				float = 2.0   ,      SCREAMING_SNAKE_CASE_    :				float = 3.1   ,      SCREAMING_SNAKE_CASE_    :				int = 8   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [3, 3, 5, 3, 5, 5, 3]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = []   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1, 2, 2, 2, 1, 2, 1]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1, 2, 2, 3, 3, 4, 1]   ,      SCREAMING_SNAKE_CASE_    :				List[int] = [1, 6, 6, 6, 6, 6, 6]   ,      SCREAMING_SNAKE_CASE_    :				float = 0.25   ,      SCREAMING_SNAKE_CASE_    :				str = "swish"   ,      SCREAMING_SNAKE_CASE_    :				int = 2_5_6_0   ,      SCREAMING_SNAKE_CASE_    :				str = "mean"   ,      SCREAMING_SNAKE_CASE_    :				float = 0.02   ,      SCREAMING_SNAKE_CASE_    :				float = 0.0_01   ,      SCREAMING_SNAKE_CASE_    :				float = 0.99   ,      SCREAMING_SNAKE_CASE_    :				float = 0.5   ,      SCREAMING_SNAKE_CASE_    :				float = 0.2   ,      **SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    Tuple								=			num_channels
        lowerCAmelCase_       :    List[Any]								=			image_size
        lowerCAmelCase_       :    Any								=			width_coefficient
        lowerCAmelCase_       :    Union[str, Any]								=			depth_coefficient
        lowerCAmelCase_       :    str								=			depth_divisor
        lowerCAmelCase_       :    Union[str, Any]								=			kernel_sizes
        lowerCAmelCase_       :    List[str]								=			in_channels
        lowerCAmelCase_       :    Optional[Any]								=			out_channels
        lowerCAmelCase_       :    List[Any]								=			depthwise_padding
        lowerCAmelCase_       :    Dict								=			strides
        lowerCAmelCase_       :    Any								=			num_block_repeats
        lowerCAmelCase_       :    Optional[Any]								=			expand_ratios
        lowerCAmelCase_       :    List[str]								=			squeeze_expansion_ratio
        lowerCAmelCase_       :    Tuple								=			hidden_act
        lowerCAmelCase_       :    Tuple								=			hidden_dim
        lowerCAmelCase_       :    Optional[int]								=			pooling_type
        lowerCAmelCase_       :    Union[str, Any]								=			initializer_range
        lowerCAmelCase_       :    List[str]								=			batch_norm_eps
        lowerCAmelCase_       :    Optional[int]								=			batch_norm_momentum
        lowerCAmelCase_       :    Dict								=			dropout_rate
        lowerCAmelCase_       :    str								=			drop_connect_rate
        lowerCAmelCase_       :    int								=			sum(SCREAMING_SNAKE_CASE_	) * 4







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					version.parse("""1.11"""  )



      @property
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        return OrderedDict(
            [
                ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
            ]	)





      @property
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple	):
        return 1E-5










"""simple docstring"""







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


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







class 				UpperCamelCase__       (     lowercase_, lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""maskformer-swin"""

      _SCREAMING_SNAKE_CASE      =					{
          """num_attention_heads""": """num_heads""",
          """num_hidden_layers""": """num_layers""",
      }



      def __init__(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=2_2_4   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=4   ,      SCREAMING_SNAKE_CASE_    :				int=3   ,      SCREAMING_SNAKE_CASE_    :				Dict=9_6   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=[2, 2, 6, 2]   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=[3, 6, 1_2, 2_4]   ,      SCREAMING_SNAKE_CASE_    :				List[str]=7   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=4.0   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=True   ,      SCREAMING_SNAKE_CASE_    :				Tuple=0.0   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=0.0   ,      SCREAMING_SNAKE_CASE_    :				int=0.1   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]="gelu"   ,      SCREAMING_SNAKE_CASE_    :				Dict=False   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=0.02   ,      SCREAMING_SNAKE_CASE_    :				int=1E-5   ,      SCREAMING_SNAKE_CASE_    :				Dict=None   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=None   ,      **SCREAMING_SNAKE_CASE_    :				str   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_	)

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





