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


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

SCREAMING_SNAKE_CASE_:					Tuple  ={
    'microsoft/resnet-50': 'https://huggingface.co/microsoft/resnet-50/blob/main/config.json',
}




class 	__A				(			UpperCamelCase__		,     UpperCamelCase__     ):
    a__	:						Optional[Any]	       =  """resnet"""
    a__	:						Tuple	       =  ["""basic""", """bottleneck"""]



    def __init__(self   :   List[Any]       ,      __a   :   Any=3       ,      __a   :   Dict=64       ,      __a   :   Union[str, Any]=[256, 512, 1024, 2048]       ,      __a   :   str=[3, 4, 6, 3]       ,      __a   :   Optional[Any]="bottleneck"       ,      __a   :   Tuple="relu"       ,      __a   :   int=False       ,      __a   :   Optional[int]=None       ,      __a   :   str=None       ,      **__a   :   Dict       ,      ):
         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			)}"""			)
         UpperCAmelCase_	   =       num_channels
         UpperCAmelCase_	   =       embedding_size
         UpperCAmelCase_	   =       hidden_sizes
         UpperCAmelCase_	   =       depths
         UpperCAmelCase_	   =       layer_type
         UpperCAmelCase_	   =       hidden_act
         UpperCAmelCase_	   =       downsample_in_first_stage
         UpperCAmelCase_	   =       ["stem"] + [f"""stage{idx}""" for idx in range(1       ,      len(__a			) + 1			)]
         UpperCAmelCase_   ,			UpperCAmelCase_	   =       get_aligned_output_features_output_indices(
             out_features=__a       ,      out_indices=__a       ,      stage_names=self.stage_names			)




class 	__A				(			UpperCamelCase__     ):
    a__	:						int	       =  version.parse("""1.11"""     )



    @property
    def  _lowercase						(self   :   Optional[int]			):
         return OrderedDict(
             [
                 ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
             ]			)






    @property
    def  _lowercase						(self   :   str			):
         return 1E-3





'''simple docstring'''





from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE_:					int  ={
    'configuration_maskformer': ['MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MaskFormerConfig'],
    'configuration_maskformer_swin': ['MaskFormerSwinConfig'],
}

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_:					List[str]  =['MaskFormerFeatureExtractor']
    SCREAMING_SNAKE_CASE_:					Union[str, Any]  =['MaskFormerImageProcessor']


try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    SCREAMING_SNAKE_CASE_:					Dict  =[
        'MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
        'MaskFormerForInstanceSegmentation',
        'MaskFormerModel',
        'MaskFormerPreTrainedModel',
    ]
    SCREAMING_SNAKE_CASE_:					List[str]  =[
        'MaskFormerSwinBackbone',
        'MaskFormerSwinModel',
        'MaskFormerSwinPreTrainedModel',
    ]

if TYPE_CHECKING:
    from .configuration_maskformer import MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskFormerConfig
    from .configuration_maskformer_swin import MaskFormerSwinConfig

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_maskformer import MaskFormerFeatureExtractor
        from .image_processing_maskformer import MaskFormerImageProcessor
    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_maskformer import (
            MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            MaskFormerForInstanceSegmentation,
            MaskFormerModel,
            MaskFormerPreTrainedModel,
        )
        from .modeling_maskformer_swin import (
            MaskFormerSwinBackbone,
            MaskFormerSwinModel,
            MaskFormerSwinPreTrainedModel,
        )


else:
    import sys

    SCREAMING_SNAKE_CASE_:					Dict  =_LazyModule(__name__, globals()['__file__'], _import_structure)




