
from collections import OrderedDict
from typing import Mapping

from packaging import version

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


UpperCAmelCase__				:  Tuple       					=				logging.get_logger(__name__)

UpperCAmelCase__				:  int       					=				{
    '''facebook/convnext-tiny-224''': '''https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json''',
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}



class 			UpperCamelCase_			(						__UpperCamelCase	,     __UpperCamelCase   ):




							'''simple docstring'''

							UpperCamelCase_					   =							"""convnext"""
							def __init__(				self     ,						UpperCamelCase=3     ,						UpperCamelCase=4     ,						UpperCamelCase=4     ,						UpperCamelCase=None     ,						UpperCamelCase=None     ,						UpperCamelCase="gelu"     ,						UpperCamelCase=0.02     ,						UpperCamelCase=1E-12     ,						UpperCamelCase=1E-6     ,						UpperCamelCase=0.0     ,						UpperCamelCase=2_24     ,						UpperCamelCase=None     ,						UpperCamelCase=None     ,						**UpperCamelCase     ,						) ->	int:
										super().__init__(**UpperCamelCase)

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



class 			UpperCamelCase_			(						__UpperCamelCase   ):




							'''simple docstring'''

							UpperCamelCase_					   =							version.parse("""1.11"""   )
							@property
							def        lowerCAmelCase__ (				self) ->	Mapping[str, Mapping[int, str]]:
										return OrderedDict(
										    [
										        ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
										    ])






							@property
							def        lowerCAmelCase__ (				self) ->	float:
										return 1E-5





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
    is_vision_available,
)


UpperCAmelCase__				:  str       					=				{
    '''configuration_mobilevitv2''': [
        '''MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''MobileViTV2Config''',
        '''MobileViTV2OnnxConfig''',
    ],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__				:  List[Any]       					=				[
							    '''MOBILEVITV2_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''MobileViTV2ForImageClassification''',
							    '''MobileViTV2ForSemanticSegmentation''',
							    '''MobileViTV2Model''',
							    '''MobileViTV2PreTrainedModel''',
							]

if TYPE_CHECKING:
							from .configuration_mobilevitva import (
							    MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    MobileViTVaConfig,
							    MobileViTVaOnnxConfig,
							)

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_mobilevitva import (
														    MOBILEVITV2_PRETRAINED_MODEL_ARCHIVE_LIST,
														    MobileViTVaForImageClassification,
														    MobileViTVaForSemanticSegmentation,
														    MobileViTVaModel,
														    MobileViTVaPreTrainedModel,
														)

else:
							import sys

							UpperCAmelCase__				:  List[str]       					=				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



