



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__)

snake_case_           =      {
    'google/bit-50': 'https://huggingface.co/google/bit-50/resolve/main/config.json',
}

class 		SCREAMING_SNAKE_CASE__    (	_UpperCAmelCase						,				_UpperCAmelCase  ):
      A_						:    Dict							=   'bit'
      A_						:    Dict							=   ['preactivation', 'bottleneck']
      A_						:    Optional[Any]							=   ['SAME', 'VALID']


      def __init__(self	:				Optional[Any]    ,      a__	:				List[str]=3    ,      a__	:				Dict=64    ,      a__	:				Optional[Any]=[256, 512, 1024, 2048]    ,      a__	:				Dict=[3, 4, 6, 3]    ,      a__	:				List[str]="preactivation"    ,      a__	:				str="relu"    ,      a__	:				Tuple=None    ,      a__	:				int=32    ,      a__	:				str=0.0    ,      a__	:				Optional[Any]=False    ,      a__	:				List[str]=32    ,      a__	:				Dict=1    ,      a__	:				Optional[Any]=None    ,      a__	:				str=None    ,      **a__	:				Optional[int]    ,      ):





         """simple docstring"""



         super().__init__(**a__				)
         if layer_type not in self.layer_types:
            raise ValueError(f"""layer_type={layer_type} is not one of {','.join(self.layer_types				)}"""				)
         if global_padding is not None:
            if global_padding.upper() in self.supported_padding:
               __snake_case								=       global_padding.upper()
            else:
               raise ValueError(f"""Padding strategy {global_padding} not supported"""				)
         __snake_case								=       num_channels
         __snake_case								=       embedding_size
         __snake_case								=       hidden_sizes
         __snake_case								=       depths
         __snake_case								=       layer_type
         __snake_case								=       hidden_act
         __snake_case								=       global_padding
         __snake_case								=       num_groups
         __snake_case								=       drop_path_rate
         __snake_case								=       embedding_dynamic_padding
         __snake_case								=       output_stride
         __snake_case								=       width_factor

         __snake_case								=       ['''stem'''] + [f"""stage{idx}""" for idx in range(1    ,      len(a__				) + 1				)]
         __snake_case	,     __snake_case								=       get_aligned_output_features_output_indices(
             out_features=a__    ,      out_indices=a__    ,      stage_names=self.stage_names				)








class 		SCREAMING_SNAKE_CASE__    :


      def __init__(self	:				str    ,      a__	:				list				):





         """simple docstring"""



         __snake_case								=       set_counts
         __snake_case								=       max(a__				)
         __snake_case								=       len(a__				)
         __snake_case								=       [1] * num_sets
         __snake_case								=       list(range(a__				)				)


      def        a			(self	:				str    ,      a__	:				int    ,      a__	:				int				):





         """simple docstring"""



         __snake_case								=       self.get_parent(a__				)
         __snake_case								=       self.get_parent(a__				)

         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]
            __snake_case								=       0
            __snake_case								=       dst_parent
            if self.ranks[dst_parent] == self.ranks[src_parent]:
               self.ranks[dst_parent] += 1
            __snake_case								=       self.set_counts[dst_parent]
         else:
            self.set_counts[src_parent] += self.set_counts[dst_parent]
            __snake_case								=       0
            __snake_case								=       src_parent
            __snake_case								=       self.set_counts[src_parent]

         __snake_case								=       max(self.max_set    ,      a__				)
         return True


      def        a			(self	:				Union[str, Any]    ,      a__	:				int				):





         """simple docstring"""



         if self.parents[disj_set] == disj_set:
            return disj_set
         __snake_case								=       self.get_parent(self.parents[disj_set]				)
         return self.parents[disj_set]

