'''simple docstring'''




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


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

_a   :	Union[str, Any] 							=   {
    'microsoft/focalnet-tiny': 'https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json',
}






class 		__A       (lowerCamelCase__ ,					lowerCamelCase__   ):
       snake_case       :List[Any]				    =					"focalnet"






       def __init__(      self				,     UpperCamelCase_=2_24				,     UpperCamelCase_=4				,     UpperCamelCase_=3				,     UpperCamelCase_=96				,     UpperCamelCase_=False				,     UpperCamelCase_=[1_92, 3_84, 7_68, 7_68]				,     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.0_2				,     UpperCamelCase_=1E-5				,     UpperCamelCase_=32				,     UpperCamelCase_=None				,     UpperCamelCase_=None				,     **UpperCamelCase_				,     ):
              super().__init__(**__lowerCamelCase      )

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





'''simple docstring'''




class 		__A       :






       def __init__(      self				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Any       				=		set_counts
              __UpperCAmelCase  :				int       				=		max(UpperCamelCase_      )
              __UpperCAmelCase  :				List[str]       				=		len(UpperCamelCase_      )
              __UpperCAmelCase  :				Any       				=		[1] * num_sets
              __UpperCAmelCase  :				Any       				=		list(range(UpperCamelCase_      )      )






       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Optional[int]       				=		self.get_parent(UpperCamelCase_      )
              __UpperCAmelCase  :				List[Any]       				=		self.get_parent(UpperCamelCase_      )

              if src_parent == dst_parent:
                     return False

              if self.ranks[dst_parent] >= self.ranks[src_parent]:
                     self.set_counts[dst_parent] += self.set_counts[src_parent]
                     __UpperCAmelCase  :				Optional[Any]       				=		0
                     __UpperCAmelCase  :				List[Any]       				=		dst_parent
                     if self.ranks[dst_parent] == self.ranks[src_parent]:
                            self.ranks[dst_parent] += 1
                     __UpperCAmelCase  :				Union[str, Any]       				=		self.set_counts[dst_parent]
              else:
                     self.set_counts[src_parent] += self.set_counts[dst_parent]
                     __UpperCAmelCase  :				Union[str, Any]       				=		0
                     __UpperCAmelCase  :				Dict       				=		src_parent
                     __UpperCAmelCase  :				Dict       				=		self.set_counts[src_parent]

              __UpperCAmelCase  :				Dict       				=		max(self.max_set				,     UpperCamelCase_      )
              return True







       def 			_snake_case						(      self				,     UpperCamelCase_      ):
              if self.parents[disj_set] == disj_set:
                     return disj_set
              __UpperCAmelCase  :				str       				=		self.get_parent(self.parents[disj_set]      )
              return self.parents[disj_set]






