




'''simple docstring'''







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


A     =logging.get_logger(__name__)

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


class 			_a  (	__a							,							__a ):
       __a				:     Union[str, Any]   				=					"""convnextv2"""
       def __init__(	self						:	str   ,				lowercase						:	Optional[Any]=3   ,				lowercase						:	Optional[Any]=4   ,				lowercase						:	Tuple=4   ,				lowercase						:	Optional[int]=None   ,				lowercase						:	Optional[int]=None   ,				lowercase						:	List[Any]="gelu"   ,				lowercase						:	str=0.02   ,				lowercase						:	List[Any]=1E-12   ,				lowercase						:	List[str]=0.0   ,				lowercase						:	Dict=224   ,				lowercase						:	Dict=None   ,				lowercase						:	List[Any]=None   ,				**lowercase						:	int   ,				):



           '''simple docstring'''

           super().__init__(**lowercase				)

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











import os
from distutils.util import strtobool



def    __lowercase   (      _SCREAMING_SNAKE_CASE ,						_SCREAMING_SNAKE_CASE	) ->   Tuple:


      '''simple docstring'''


      for e in env_keys:
            SCREAMING_SNAKE_CASE		=						int(os.environ.get(_SCREAMING_SNAKE_CASE ,						-1	)	)
            if val >= 0:
                  return val
      return default



def    __lowercase   (      _SCREAMING_SNAKE_CASE ,						_SCREAMING_SNAKE_CASE=False	) ->   Optional[int]:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE		=						os.environ.get(_SCREAMING_SNAKE_CASE ,						str(_SCREAMING_SNAKE_CASE	)	)
      return strtobool(_SCREAMING_SNAKE_CASE	) == 1  # As its name indicates `strtobool` actually returns an int...



def    __lowercase   (      _SCREAMING_SNAKE_CASE ,						_SCREAMING_SNAKE_CASE="no"	) ->   Any:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE		=						os.environ.get(_SCREAMING_SNAKE_CASE ,						str(_SCREAMING_SNAKE_CASE	)	)
      return value


