




'''simple docstring'''




from ctypes import c_float, sizeof
from enum import Enum
from typing import TYPE_CHECKING, Optional, Union


if TYPE_CHECKING:
					from .. import AutoFeatureExtractor, AutoProcessor, AutoTokenizer  # tests_ignore






class     UpperCamelCase_     (a__     ):







						"""simple docstring"""


						_lowerCAmelCase    						=					c_float







						@property
						def       _a    (     self      :       str    ):





											"""simple docstring"""







											return sizeof(self.value    )






def 						snake_case__    ( lowerCamelCase__				:   int			,		lowerCamelCase__				:   int			,		lowerCamelCase__				:   int = 0			)   ->   int:
					# < 0 is possible if using a dynamic axis
					if dimension <= 0:
										A_ :     Optional[int] =							fixed_dimension

					dimension -= num_token_to_add
					return dimension




def 						snake_case__    ( lowerCamelCase__				:   int			,		lowerCamelCase__				:   ParameterFormat			)   ->   int:
					return num_parameters * dtype.size





def 						snake_case__    ( lowerCamelCase__				:   str			)   ->   Optional[Union["AutoTokenizer", "AutoFeatureExtractor", "AutoProcessor"]]:
					from .. import AutoFeatureExtractor, AutoProcessor, AutoTokenizer  # tests_ignore

					try:
										return AutoProcessor.from_pretrained(lowerCamelCase__			)
					except (ValueError, OSError, KeyError):
										A_ :     str =							None, None
										try:
															A_ :     Union[str, Any] =							AutoTokenizer.from_pretrained(lowerCamelCase__			)
										except (OSError, KeyError):
															pass
										try:
															A_ :     Optional[Any] =							AutoFeatureExtractor.from_pretrained(lowerCamelCase__			)
										except (OSError, KeyError):
															pass

										if tokenizer is not None and feature_extractor is not None:
															raise ValueError(
															    f'Couldn\'t auto-detect preprocessor for {model_name}. Found both a tokenizer and a feature extractor.'			)
										elif tokenizer is None and feature_extractor is None:
															return None
										elif tokenizer is not None:
															return tokenizer
										else:
															return feature_extractor









'''simple docstring'''




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case__          =						{"""configuration_nat""": ["""NAT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NatConfig"""]}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							snake_case__          =						[
							    """NAT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """NatForImageClassification""",
							    """NatModel""",
							    """NatPreTrainedModel""",
							    """NatBackbone""",
							]

if TYPE_CHECKING:
							from .configuration_nat import NAT_PRETRAINED_CONFIG_ARCHIVE_MAP, NatConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_nat import (
														    NAT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    NatBackbone,
														    NatForImageClassification,
														    NatModel,
														    NatPreTrainedModel,
														)

else:
							import sys

							snake_case__          =						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



