
'''simple docstring'''







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


_lowercase :  List[str]    							=       logging.get_logger(__name__)

_lowercase :  Any    							=       {
    "shi-labs/dinat-mini-in1k-224": "https://huggingface.co/shi-labs/dinat-mini-in1k-224/resolve/main/config.json",
    # See all Dinat models at https://huggingface.co/models?filter=dinat
}






class  lowerCAmelCase__   (  lowerCamelCase_    ,						lowerCamelCase_     ):
					lowerCAmelCase_        =     '''dinat'''

					lowerCAmelCase_        =     {
					    '''num_attention_heads''': '''num_heads''',
					    '''num_hidden_layers''': '''num_layers''',
					}






					def __init__(   self				,							__SCREAMING_SNAKE_CASE=4				,							__SCREAMING_SNAKE_CASE=3				,							__SCREAMING_SNAKE_CASE=64				,							__SCREAMING_SNAKE_CASE=[3, 4, 6, 5]				,							__SCREAMING_SNAKE_CASE=[2, 4, 8, 16]				,							__SCREAMING_SNAKE_CASE=7				,							__SCREAMING_SNAKE_CASE=[[1, 8, 1], [1, 4, 1, 4], [1, 2, 1, 2, 1, 2], [1, 1, 1, 1, 1]]				,							__SCREAMING_SNAKE_CASE=3.0				,							__SCREAMING_SNAKE_CASE=True				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=0.1				,							__SCREAMING_SNAKE_CASE="gelu"				,							__SCREAMING_SNAKE_CASE=0.02				,							__SCREAMING_SNAKE_CASE=1E-5				,							__SCREAMING_SNAKE_CASE=0.0				,							__SCREAMING_SNAKE_CASE=None				,							__SCREAMING_SNAKE_CASE=None				,							**__SCREAMING_SNAKE_CASE				,							):


											"""simple docstring"""





											super().__init__(**__SCREAMING_SNAKE_CASE		)

											lowercase_	:     List[Any]													=       patch_size
											lowercase_	:     Any													=       num_channels
											lowercase_	:     str													=       embed_dim
											lowercase_	:     List[str]													=       depths
											lowercase_	:     Any													=       len(__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Dict													=       num_heads
											lowercase_	:     Tuple													=       kernel_size
											lowercase_	:     Union[str, Any]													=       dilations
											lowercase_	:     List[str]													=       mlp_ratio
											lowercase_	:     Any													=       qkv_bias
											lowercase_	:     List[str]													=       hidden_dropout_prob
											lowercase_	:     Union[str, Any]													=       attention_probs_dropout_prob
											lowercase_	:     Tuple													=       drop_path_rate
											lowercase_	:     List[str]													=       hidden_act
											lowercase_	:     List[Any]													=       layer_norm_eps
											lowercase_	:     int													=       initializer_range
											# we set the hidden_size attribute in order to make Dinat work with VisionEncoderDecoderModel
											# this indicates the channel dimension after the last stage of the model
											lowercase_	:     List[Any]													=       int(embed_dim * 2 ** (len(__SCREAMING_SNAKE_CASE		) - 1)		)
											lowercase_	:     Dict													=       layer_scale_init_value
											lowercase_	:     Optional[int]													=       ['''stem'''] + [F'''stage{idx}''' for idx in range(1				,							len(__SCREAMING_SNAKE_CASE		) + 1		)]
											lowercase_						, lowercase_	:     Optional[Any]													=       get_aligned_output_features_output_indices(
											    out_features=__SCREAMING_SNAKE_CASE				,							out_indices=__SCREAMING_SNAKE_CASE				,							stage_names=self.stage_names		)









from typing import TYPE_CHECKING

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


__lowerCAmelCase		:				List[str]       			=		{
    'configuration_resnet': ['RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ResNetConfig', 'ResNetOnnxConfig']
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__lowerCAmelCase		:				Dict       			=		[
		    'RESNET_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'ResNetForImageClassification',
		    'ResNetModel',
		    'ResNetPreTrainedModel',
		    'ResNetBackbone',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__lowerCAmelCase		:				int       			=		[
		    'TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'TFResNetForImageClassification',
		    'TFResNetModel',
		    'TFResNetPreTrainedModel',
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__lowerCAmelCase		:				Optional[Any]       			=		[
		    'FlaxResNetForImageClassification',
		    'FlaxResNetModel',
		    'FlaxResNetPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_resnet import RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP, ResNetConfig, ResNetOnnxConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_resnet import (
				    RESNET_PRETRAINED_MODEL_ARCHIVE_LIST,
				    ResNetBackbone,
				    ResNetForImageClassification,
				    ResNetModel,
				    ResNetPreTrainedModel,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_resnet import (
				    TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFResNetForImageClassification,
				    TFResNetModel,
				    TFResNetPreTrainedModel,
				)

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_resnet import FlaxResNetForImageClassification, FlaxResNetModel, FlaxResNetPreTrainedModel


else:
		import sys

		__lowerCAmelCase		:				int       			=		_LazyModule(__name__, globals()['__file__'], _import_structure)






