



'''simple docstring'''

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


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

_A				:    Optional[Any]     						={
    '''microsoft/resnet-50''': '''https://huggingface.co/microsoft/resnet-50/blob/main/config.json''',
}



class 		lowerCamelCase__      (						A	,   A     ):




	'''simple docstring'''



	A_						    =						'resnet'
	A_						    =						['basic', 'bottleneck']




	def __init__(  self				:	List[Any]     ,  UpperCamelCase_				:	Union[str, Any]=3     ,  UpperCamelCase_				:	str=64     ,  UpperCamelCase_				:	Optional[int]=[256, 512, 1024, 2048]     ,  UpperCamelCase_				:	str=[3, 4, 6, 3]     ,  UpperCamelCase_				:	Any="bottleneck"     ,  UpperCamelCase_				:	List[str]="relu"     ,  UpperCamelCase_				:	str=False     ,  UpperCamelCase_				:	Optional[Any]=None     ,  UpperCamelCase_				:	Union[str, Any]=None     ,  **UpperCamelCase_				:	str     ,  )  ->       str:



		'''simple docstring'''





		super().__init__(**UpperCamelCase_					)
		if layer_type not in self.layer_types:
			raise ValueError(F'''layer_type={layer_type} is not one of {",".join(self.layer_types					)}'''					)
		_lowercase					:       Optional[int]       =		num_channels
		_lowercase					:       Tuple       =		embedding_size
		_lowercase					:       Any       =		hidden_sizes
		_lowercase					:       Union[str, Any]       =		depths
		_lowercase					:       List[str]       =		layer_type
		_lowercase					:       List[str]       =		hidden_act
		_lowercase					:       List[str]       =		downsample_in_first_stage
		_lowercase					:       List[str]       =		['stem'] + [F'''stage{idx}''' for idx in range(1     ,  len(UpperCamelCase_					) + 1					)]
		_lowercase  ,    _lowercase					:       Optional[Any]       =		get_aligned_output_features_output_indices(
		    out_features=UpperCamelCase_     ,  out_indices=UpperCamelCase_     ,  stage_names=self.stage_names					)






class 		lowerCamelCase__      (						A     ):




	'''simple docstring'''



	A_						    =						version.parse("""1.11"""     )




	@property
	def 						__UpperCAmelCase     (  self				:	Any					)  ->       Mapping[str, Mapping[int, str]]:



		'''simple docstring'''





		return OrderedDict(
		    [
		        ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
		    ]					)




	@property
	def 						__UpperCAmelCase     (  self				:	Optional[int]					)  ->       float:



		'''simple docstring'''





		return 1E-3





'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
)


_A				:    Union[str, Any]     						={'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ReformerConfig''']}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    Dict     						=['''ReformerTokenizer''']

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    Union[str, Any]     						=['''ReformerTokenizerFast''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    str     						=[
		    '''REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''ReformerAttention''',
		    '''ReformerForMaskedLM''',
		    '''ReformerForQuestionAnswering''',
		    '''ReformerForSequenceClassification''',
		    '''ReformerLayer''',
		    '''ReformerModel''',
		    '''ReformerModelWithLMHead''',
		    '''ReformerPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_reformer import ReformerTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_reformer_fast import ReformerTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_reformer import (
				    REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    ReformerAttention,
				    ReformerForMaskedLM,
				    ReformerForQuestionAnswering,
				    ReformerForSequenceClassification,
				    ReformerLayer,
				    ReformerModel,
				    ReformerModelWithLMHead,
				    ReformerPreTrainedModel,
				)

else:
		import sys

		_A				:    Union[str, Any]     						=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
