'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


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

lowercase__  :      Optional[Any] =					{
    "facebook/convnextv2-tiny-1k-224": "https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json",
}







class lowerCamelCase							(	UpperCAmelCase__     ,		UpperCAmelCase__					):




  '''simple docstring'''



  lowerCAmelCase__										=	'convnextv2'






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

        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_            =  get_aligned_output_features_output_indices(
            out_features=UpperCAmelCase__  ,							out_indices=UpperCAmelCase__  ,							stage_names=self.stage_names  )






'''simple docstring'''
from typing import TYPE_CHECKING

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


lowercase__  :      Union[str, Any]        =					{
    "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileViTConfig", "MobileViTOnnxConfig"],
}

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase__  :      Union[str, Any]        =					["MobileViTFeatureExtractor"]
      lowercase__  :      List[Any]        =					["MobileViTImageProcessor"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase__  :      Dict        =					[
          "MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "MobileViTForImageClassification",
          "MobileViTForSemanticSegmentation",
          "MobileViTModel",
          "MobileViTPreTrainedModel",
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase__  :      Optional[int]        =					[
          "TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "TFMobileViTForImageClassification",
          "TFMobileViTForSemanticSegmentation",
          "TFMobileViTModel",
          "TFMobileViTPreTrainedModel",
      ]

if TYPE_CHECKING:
      from .configuration_mobilevit import MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP, MobileViTConfig, MobileViTOnnxConfig

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_mobilevit import MobileViTFeatureExtractor
            from .image_processing_mobilevit import MobileViTImageProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_mobilevit import (
                MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                MobileViTForImageClassification,
                MobileViTForSemanticSegmentation,
                MobileViTModel,
                MobileViTPreTrainedModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_mobilevit import (
                TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                TFMobileViTForImageClassification,
                TFMobileViTForSemanticSegmentation,
                TFMobileViTModel,
                TFMobileViTPreTrainedModel,
            )


else:
      import sys

      lowercase__  :      int        =					_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





