




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


_lowerCAmelCase  :      Optional[int]						=      logging.get_logger(__name__)

_lowerCAmelCase  :      Tuple						=      {
    "shi-labs/nat-mini-in1k-224": "https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json",
    # See all Nat models at https://huggingface.co/models?filter=nat
}
class 	_UpperCamelCase					( UpperCAmelCase__		,				UpperCAmelCase__						):
      UpperCAmelCase_						=						'nat'

      UpperCAmelCase_						=						{
          'num_attention_heads': 'num_heads',
          'num_hidden_layers': 'num_layers',
      }
      def __init__(	self      :Optional[Any]       ,					lowerCamelCase      :Any=4       ,					lowerCamelCase      :str=3       ,					lowerCamelCase      :int=64       ,					lowerCamelCase      :str=[3, 4, 6, 5]       ,					lowerCamelCase      :int=[2, 4, 8, 16]       ,					lowerCamelCase      :int=7       ,					lowerCamelCase      :Tuple=3.0       ,					lowerCamelCase      :Optional[int]=True       ,					lowerCamelCase      :List[str]=0.0       ,					lowerCamelCase      :List[str]=0.0       ,					lowerCamelCase      :Tuple=0.1       ,					lowerCamelCase      :List[str]="gelu"       ,					lowerCamelCase      :Union[str, Any]=0.02       ,					lowerCamelCase      :Tuple=1e-5       ,					lowerCamelCase      :Dict=0.0       ,					lowerCamelCase      :Optional[int]=None       ,					lowerCamelCase      :Union[str, Any]=None       ,					**lowerCamelCase      :int       ,					)   ->	Tuple:
       super().__init__(**_SCREAMING_SNAKE_CASE					)

       UpperCAmelCase__							       =  patch_size
       UpperCAmelCase__							       =  num_channels
       UpperCAmelCase__							       =  embed_dim
       UpperCAmelCase__							       =  depths
       UpperCAmelCase__							       =  len(_SCREAMING_SNAKE_CASE					)
       UpperCAmelCase__							       =  num_heads
       UpperCAmelCase__							       =  kernel_size
       UpperCAmelCase__							       =  mlp_ratio
       UpperCAmelCase__							       =  qkv_bias
       UpperCAmelCase__							       =  hidden_dropout_prob
       UpperCAmelCase__							       =  attention_probs_dropout_prob
       UpperCAmelCase__							       =  drop_path_rate
       UpperCAmelCase__							       =  hidden_act
       UpperCAmelCase__							       =  layer_norm_eps
       UpperCAmelCase__							       =  initializer_range
       # we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
       # this indicates the channel dimension after the last stage of the model
       UpperCAmelCase__							       =  int(embed_dim * 2 ** (len(_SCREAMING_SNAKE_CASE					) - 1)					)
       UpperCAmelCase__							       =  layer_scale_init_value
       UpperCAmelCase__							       =  ["""stem"""] + [f'''stage{idx}''' for idx in range(1       ,					len(_SCREAMING_SNAKE_CASE					) + 1					)]
       UpperCAmelCase__							       =  get_aligned_output_features_output_indices(
           out_features=_SCREAMING_SNAKE_CASE       ,					out_indices=_SCREAMING_SNAKE_CASE       ,					stage_names=self.stage_names					)










"""simple docstring"""
from typing import TYPE_CHECKING

from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available
from ...utils import OptionalDependencyNotAvailable


A:   List[str]								=		{"configuration_dpt": ["DPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DPTConfig"]}

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A:   Tuple								=		["DPTFeatureExtractor"]
      A:   int								=		["DPTImageProcessor"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A:   Optional[Any]								=		[
          "DPT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "DPTForDepthEstimation",
          "DPTForSemanticSegmentation",
          "DPTModel",
          "DPTPreTrainedModel",
      ]


if TYPE_CHECKING:
      from .configuration_dpt import DPT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPTConfig

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_dpt import DPTFeatureExtractor
            from .image_processing_dpt import DPTImageProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_dpt import (
                DPT_PRETRAINED_MODEL_ARCHIVE_LIST,
                DPTForDepthEstimation,
                DPTForSemanticSegmentation,
                DPTModel,
                DPTPreTrainedModel,
            )


else:
      import sys

      A:   str								=		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
