
"""simple docstring"""

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


_A						=			logging.get_logger(__name__)

_A						=			{
    'microsoft/focalnet-tiny': 'https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json',
}






class 	_lowercase       (    __UpperCAmelCase    ,	__UpperCAmelCase		):
	lowercase_				=     'focalnet'




	def __init__(			self		,			UpperCAmelCase_=224		,			UpperCAmelCase_=4		,			UpperCAmelCase_=3		,			UpperCAmelCase_=96		,			UpperCAmelCase_=False		,			UpperCAmelCase_=[192, 384, 768, 768]		,			UpperCAmelCase_=[2, 2, 6, 2]		,			UpperCAmelCase_=[2, 2, 2, 2]		,			UpperCAmelCase_=[3, 3, 3, 3]		,			UpperCAmelCase_="gelu"		,			UpperCAmelCase_=4.0		,			UpperCAmelCase_=0.0		,			UpperCAmelCase_=0.1		,			UpperCAmelCase_=False		,			UpperCAmelCase_=1E-4		,			UpperCAmelCase_=False		,			UpperCAmelCase_=False		,			UpperCAmelCase_=False		,			UpperCAmelCase_=0.02		,			UpperCAmelCase_=1E-5		,			UpperCAmelCase_=32		,			UpperCAmelCase_=None		,			UpperCAmelCase_=None		,			**UpperCAmelCase_		,			)		->							str:
			super().__init__(**UpperCAmelCase_ )

			lowerCamelCase					:      Dict          =   image_size
			lowerCamelCase					:      Any          =   patch_size
			lowerCamelCase					:      str          =   num_channels
			lowerCamelCase					:      int          =   embed_dim
			lowerCamelCase					:      Union[str, Any]          =   use_conv_embed
			lowerCamelCase					:      Any          =   hidden_sizes
			lowerCamelCase					:      Union[str, Any]          =   depths
			lowerCamelCase					:      int          =   focal_levels
			lowerCamelCase					:      Dict          =   focal_windows
			lowerCamelCase					:      Optional[int]          =   hidden_act
			lowerCamelCase					:      List[Any]          =   mlp_ratio
			lowerCamelCase					:      List[str]          =   hidden_dropout_prob
			lowerCamelCase					:      int          =   drop_path_rate
			lowerCamelCase					:      List[Any]          =   use_layerscale
			lowerCamelCase					:      str          =   layerscale_value
			lowerCamelCase					:      Optional[int]          =   use_post_layernorm
			lowerCamelCase					:      Optional[Any]          =   use_post_layernorm_in_modulation
			lowerCamelCase					:      Union[str, Any]          =   normalize_modulator
			lowerCamelCase					:      Optional[Any]          =   initializer_range
			lowerCamelCase					:      int          =   layer_norm_eps
			lowerCamelCase					:      Optional[Any]          =   encoder_stride
			lowerCamelCase					:      Dict          =   ['stem'] + [F"""stage{idx}""" for idx in range(1		,			len(self.depths ) + 1 )]
			lowerCamelCase     ,   lowerCamelCase					:      Optional[int]          =   get_aligned_output_features_output_indices(
			    out_features=UpperCAmelCase_		,			out_indices=UpperCAmelCase_		,			stage_names=self.stage_names )








"""simple docstring"""

# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


_A						=			re.compile(r'^(?P<major>\d+)' r'\.(?P<minor>\d+)' r'\.(?P<patch>\d+)$')






@total_ordering
@dataclass
class 	_lowercase       :
	lowercase_				=     42
	lowercase_				=     None
	lowercase_				=     None
	lowercase_				=     None
	lowercase_				=     None




	def       _UpperCamelCase   (			self )		->							List[str]:
			lowerCamelCase     ,   lowerCamelCase     ,   lowerCamelCase					:      List[str]          =   _str_to_version_tuple(self.version_str )




	def __repr__(			self )		->							int:
			return F"""{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}"""




	@property
	def       _UpperCamelCase   (			self )		->							Dict:
			return self.major, self.minor, self.patch




	def       _UpperCamelCase   (			self		,			UpperCAmelCase_ )		->							Optional[int]:
			if isinstance(UpperCAmelCase_		,			UpperCAmelCase_ ):
					return Version(UpperCAmelCase_ )
			elif isinstance(UpperCAmelCase_		,			UpperCAmelCase_ ):
					return other
			raise TypeError(F"""{other} (type {type(UpperCAmelCase_ )}) cannot be compared to version.""" )




	def __eq__(			self		,			UpperCAmelCase_ )		->							Optional[Any]:
			try:
					lowerCamelCase					:      List[str]          =   self._validate_operand(UpperCAmelCase_ )
			except (TypeError, ValueError):
					return False
			else:
					return self.tuple == other.tuple




	def __lt__(			self		,			UpperCAmelCase_ )		->							Optional[int]:
			lowerCamelCase					:      Optional[int]          =   self._validate_operand(UpperCAmelCase_ )
			return self.tuple < other.tuple




	def __hash__(			self )		->							Optional[Any]:
			return hash(_version_tuple_to_str(self.tuple ) )




	@classmethod
	def       _UpperCamelCase   (			cls		,			UpperCAmelCase_ )		->							Union[str, Any]:
			lowerCamelCase					:      str          =   {f.name for f in dataclasses.fields(cls )}
			return cls(**{k: v for k, v in dic.items() if k in field_names} )




	def       _UpperCamelCase   (			self )		->							str:
			return self.version_str


def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


		lowerCamelCase					:      Tuple          =   _VERSION_REG.match(a_      )
		if not res:
				raise ValueError(F"""Invalid version '{version_str}'. Format should be x.y.z with {{x,y,z}} being digits."""      )
		return tuple(int(a_      ) for v in [res.group('major'      ), res.group('minor'      ), res.group('patch'      )]      )





def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


		return ".".join(str(a_      ) for v in version_tuple      )






