




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


lowerCamelCase__			:       Optional[Any]         =							logging.get_logger(__name__)

lowerCamelCase__			:       List[str]         =							{
    'facebook/convnextv2-tiny-1k-224': 'https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json',
}





class 	lowerCamelCase_							(				_SCREAMING_SNAKE_CASE	,       _SCREAMING_SNAKE_CASE ):


	'''simple docstring'''







	lowercase_       =   "convnextv2"



	def __init__(							self  :		Optional[int]    ,    _lowerCAmelCase  :		Union[str, Any]=3    ,    _lowerCAmelCase  :		str=4    ,    _lowerCAmelCase  :		Union[str, Any]=4    ,    _lowerCAmelCase  :		Optional[Any]=None    ,    _lowerCAmelCase  :		Tuple=None    ,    _lowerCAmelCase  :		List[Any]="gelu"    ,    _lowerCAmelCase  :		Optional[Any]=0.02    ,    _lowerCAmelCase  :		Union[str, Any]=1E-12    ,    _lowerCAmelCase  :		Tuple=0.0    ,    _lowerCAmelCase  :		Any=224    ,    _lowerCAmelCase  :		int=None    ,    _lowerCAmelCase  :		Dict=None    ,    **_lowerCAmelCase  :		Tuple    ,    ):
							super().__init__(**_lowerCAmelCase						)

							SCREAMING_SNAKE_CASE_     						=      num_channels
							SCREAMING_SNAKE_CASE_     						=      patch_size
							SCREAMING_SNAKE_CASE_     						=      num_stages
							SCREAMING_SNAKE_CASE_     						=      [96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
							SCREAMING_SNAKE_CASE_     						=      [3, 3, 9, 3] if depths is None else depths
							SCREAMING_SNAKE_CASE_     						=      hidden_act
							SCREAMING_SNAKE_CASE_     						=      initializer_range
							SCREAMING_SNAKE_CASE_     						=      layer_norm_eps
							SCREAMING_SNAKE_CASE_     						=      drop_path_rate
							SCREAMING_SNAKE_CASE_     						=      image_size
							SCREAMING_SNAKE_CASE_     						=      ['stem'] + [F"stage{idx}" for idx in range(1    ,    len(self.depths						) + 1						)]
							SCREAMING_SNAKE_CASE_						,			SCREAMING_SNAKE_CASE_     						=      get_aligned_output_features_output_indices(
							    out_features=_lowerCAmelCase    ,    out_indices=_lowerCAmelCase    ,    stage_names=self.stage_names						)





def  UpperCAmelCase_							(				__UpperCAmelCase						:     Optional[Any]      ,      __UpperCAmelCase						:     Union[str, Any]							) ->			List[str]:
      SCREAMING_SNAKE_CASE_     						=      0
      while b > 0:
            if b & 1:
                  res += a

            a += a
            b >>= 1

      return res

def  UpperCAmelCase_							(				__UpperCAmelCase						:     str      ,      __UpperCAmelCase						:     int      ,      __UpperCAmelCase						:     Tuple							) ->			int:
      SCREAMING_SNAKE_CASE_     						=      0
      while b > 0:
            if b & 1:
                  SCREAMING_SNAKE_CASE_     						=      ((res % c) + (a % c)) % c

            a += a
            b >>= 1

      return res