




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


lowerCamelCase__					:  Union[str, Any]      							=				logging.get_logger(__name__)

lowerCamelCase__					:  Tuple      							=				{
    '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    :						Tuple							,							_lowerCAmelCase    :						str=3							,							_lowerCAmelCase    :						Optional[int]=4							,							_lowerCAmelCase    :						List[str]=4							,							_lowerCAmelCase    :						Any=None							,							_lowerCAmelCase    :						Tuple=None							,							_lowerCAmelCase    :						int="gelu"							,							_lowerCAmelCase    :						Optional[Any]=0.02							,							_lowerCAmelCase    :						Any=1E-12							,							_lowerCAmelCase    :						Union[str, Any]=0.0							,							_lowerCAmelCase    :						Dict=224							,							_lowerCAmelCase    :						Union[str, Any]=None							,							_lowerCAmelCase    :						Union[str, Any]=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		:      list     ,     __UpperCAmelCase		:      int     ,     __UpperCAmelCase		:      int = 0     ,     __UpperCAmelCase		:      int = 0				)   ->					int:
      SCREAMING_SNAKE_CASE_      		=     right or len(__UpperCAmelCase				) - 1
      if left > right:
            return -1
      elif list_data[left] == key:
            return left
      elif list_data[right] == key:
            return right
      else:
            return search(__UpperCAmelCase     ,     __UpperCAmelCase     ,     left + 1     ,     right - 1				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()