


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


SCREAMING_SNAKE_CASE__     					=			logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__     					=			{
    "facebook/convnextv2-tiny-1k-224": "https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json",
}



class 						_UpperCAmelCase      (     lowercase		,		lowercase							):
		lowerCamelCase_	:			int       			=  """convnextv2"""






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

				SCREAMING_SNAKE_CASE_				:Dict				     =						num_channels
				SCREAMING_SNAKE_CASE_				:Optional[Any]				     =						patch_size
				SCREAMING_SNAKE_CASE_				:List[str]				     =						num_stages
				SCREAMING_SNAKE_CASE_				:Any				     =						[96, 1_92, 3_84, 7_68] if hidden_sizes is None else hidden_sizes
				SCREAMING_SNAKE_CASE_				:Tuple				     =						[3, 3, 9, 3] if depths is None else depths
				SCREAMING_SNAKE_CASE_				:int				     =						hidden_act
				SCREAMING_SNAKE_CASE_				:int				     =						initializer_range
				SCREAMING_SNAKE_CASE_				:int				     =						layer_norm_eps
				SCREAMING_SNAKE_CASE_				:int				     =						drop_path_rate
				SCREAMING_SNAKE_CASE_				:Dict				     =						image_size
				SCREAMING_SNAKE_CASE_				:Union[str, Any]				     =						["stem"] + [F"stage{idx}" for idx in range(1   ,  len(self.depths) + 1)]
				SCREAMING_SNAKE_CASE_     ,				SCREAMING_SNAKE_CASE_				:List[Any]				     =						get_aligned_output_features_output_indices(
				    out_features=UpperCAmelCase   ,  out_indices=UpperCAmelCase   ,  stage_names=self.stage_names)










from timeit import timeit


def     lowercase	(    a ):



		'''simple docstring'''




		if number < 0:
				raise ValueError("the value of input must not be negative" )
		SCREAMING_SNAKE_CASE_				:Optional[int]				     =						0
		while number:
				number &= number - 1
				result += 1
		return result


def     lowercase	(    a ):



		'''simple docstring'''




		if number < 0:
				raise ValueError("the value of input must not be negative" )
		SCREAMING_SNAKE_CASE_				:List[Any]				     =						0
		while number:
				if number % 2 == 1:
						result += 1
				number >>= 1
		return result


def     lowercase	(    ):



		'''simple docstring'''




		def do_benchmark(a ) -> None:
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						"import __main__ as z"
				print(F"Benchmark when {number = }:" )
				print(F"{get_set_bits_count_using_modulo_operator(a ) = }" )
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						timeit("z.get_set_bits_count_using_modulo_operator(25)"     , setup=a )
				print(F"timeit() runs in {timing} seconds" )
				print(F"{get_set_bits_count_using_brian_kernighans_algorithm(a ) = }" )
				SCREAMING_SNAKE_CASE_				:str				     =						timeit(
				    "z.get_set_bits_count_using_brian_kernighans_algorithm(25)"     , setup=a     , )
				print(F"timeit() runs in {timing} seconds" )

		for number in (25, 37, 58, 0):
				do_benchmark(a )
				print()


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		benchmark()






