





import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


__A     =    logging.get_logger(__name__)



class        _SCREAMING_SNAKE_CASE						(     __a   ):







 '''simple docstring'''
 lowercase_		=      """upernet"""

 def __init__(self    :       Optional[int]	,			UpperCAmelCase_    :       Optional[int]=None	,			UpperCAmelCase_    :       List[str]=512	,			UpperCAmelCase_    :       Dict=0.02	,			UpperCAmelCase_    :       Optional[Any]=[1, 2, 3, 6]	,			UpperCAmelCase_    :       Optional[int]=True	,			UpperCAmelCase_    :       Dict=0.4	,			UpperCAmelCase_    :       Tuple=384	,			UpperCAmelCase_    :       Optional[Any]=256	,			UpperCAmelCase_    :       Dict=1	,			UpperCAmelCase_    :       int=False	,			UpperCAmelCase_    :       List[str]=255	,			**UpperCAmelCase_    :       List[str]	,			)	->Any:



   '''simple docstring'''



   super().__init__(**a__)

   if backbone_config is None:
     logger.info("`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.")
     lowerCamelCase__:				Any        =CONFIG_MAPPING["resnet"](out_features=["stage1", "stage2", "stage3", "stage4"])
   elif isinstance(a__	,			a__):
     lowerCamelCase__:				List[Any]        =backbone_config.get("model_type")
     lowerCamelCase__:				Optional[Any]        =CONFIG_MAPPING[backbone_model_type]
     lowerCamelCase__:				Any        =config_class.from_dict(a__)

   lowerCamelCase__:				str        =backbone_config
   lowerCamelCase__:				List[str]        =hidden_size
   lowerCamelCase__:				Any        =initializer_range
   lowerCamelCase__:				Any        =pool_scales
   lowerCamelCase__:				Tuple        =use_auxiliary_head
   lowerCamelCase__:				int        =auxiliary_loss_weight
   lowerCamelCase__:				Any        =auxiliary_in_channels
   lowerCamelCase__:				List[Any]        =auxiliary_channels
   lowerCamelCase__:				List[Any]        =auxiliary_num_convs
   lowerCamelCase__:				Tuple        =auxiliary_concat_input
   lowerCamelCase__:				Dict        =loss_ignore_index







 def 							SCREAMING_SNAKE_CASE_ (self    :       Tuple)	->Tuple:



   '''simple docstring'''



   lowerCamelCase__:				Dict        =copy.deepcopy(self.__dict__)
   lowerCamelCase__:				int        =self.backbone_config.to_dict()
   lowerCamelCase__:				Tuple        =self.__class__.model_type
   return output













from ..utils import DummyObject, requires_backends



class        _SCREAMING_SNAKE_CASE						(     metaclass=__SCREAMING_SNAKE_CASE   ):







 '''simple docstring'''
 lowercase_		=      ["torch", "torchsde"]

 def __init__(self    :       Union[str, Any]	,			*UpperCAmelCase_    :       Dict	,			**UpperCAmelCase_    :       Tuple)	->Any:



   '''simple docstring'''



   requires_backends(self	,			["torch", "torchsde"])

 @classmethod
 def 							SCREAMING_SNAKE_CASE_ (cls    :       Dict	,			*UpperCAmelCase_    :       Optional[int]	,			**UpperCAmelCase_    :       Optional[int])	->List[Any]:



   '''simple docstring'''



   requires_backends(cls	,			["torch", "torchsde"])







 @classmethod
 def 							SCREAMING_SNAKE_CASE_ (cls    :       Tuple	,			*UpperCAmelCase_    :       Tuple	,			**UpperCAmelCase_    :       Any)	->Any:



   '''simple docstring'''



   requires_backends(cls	,			["torch", "torchsde"])

