"""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


__magic_name__     					=       logging.get_logger(__name__)

__magic_name__     					=       {
    """microsoft/resnet-50""": """https://huggingface.co/microsoft/resnet-50/blob/main/config.json""",
}

class SCREAMING_SNAKE_CASE  (     a_ ,   a_						):







 """simple docstring"""


 a_							:						Optional[int]	      ="resnet"
 a_							:						Any	      =["basic", "bottleneck"]


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




    '''simple docstring'''






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

class SCREAMING_SNAKE_CASE  (     a_						):







 """simple docstring"""


 a_							:						Tuple	      =version.parse("1.11"						)


 @property
 def 							_lowerCAmelCase					( self		:   Dict					)					->      List[Any]:




    '''simple docstring'''






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



 @property
 def 							_lowerCAmelCase					( self		:   Optional[Any]					)					->      Optional[int]:




    '''simple docstring'''






    return 1E-3




"""simple docstring"""




# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_A     :			Optional[int]  						=			{
    """configuration_mgp_str""": ["""MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MgpstrConfig"""],
    """processing_mgp_str""": ["""MgpstrProcessor"""],
    """tokenization_mgp_str""": ["""MgpstrTokenizer"""],
}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A     :			Any  						=			[
       """MGP_STR_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """MgpstrModel""",
       """MgpstrPreTrainedModel""",
       """MgpstrForSceneTextRecognition""",
   ]

if TYPE_CHECKING:
   from .configuration_mgp_str import MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP, MgpstrConfig
   from .processing_mgp_str import MgpstrProcessor
   from .tokenization_mgp_str import MgpstrTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_mgp_str import (
          MGP_STR_PRETRAINED_MODEL_ARCHIVE_LIST,
          MgpstrForSceneTextRecognition,
          MgpstrModel,
          MgpstrPreTrainedModel,
      )
else:
   import sys

   _A     :			Tuple  						=			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


