





from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


UpperCAmelCase_           =	logging.get_logger(__name__)

UpperCAmelCase_           =	{
    "microsoft/focalnet-tiny": "https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json",
}




class 			__UpperCamelCase    (							A__	, A__    ):
     __A	:  Union[str, Any]							  =   """focalnet"""





     def __init__(     self				,							_UpperCamelCase=224				,							_UpperCamelCase=4				,							_UpperCamelCase=3				,							_UpperCamelCase=96				,							_UpperCamelCase=False				,							_UpperCamelCase=[192, 384, 768, 768]				,							_UpperCamelCase=[2, 2, 6, 2]				,							_UpperCamelCase=[2, 2, 2, 2]				,							_UpperCamelCase=[3, 3, 3, 3]				,							_UpperCamelCase="gelu"				,							_UpperCamelCase=4.0				,							_UpperCamelCase=0.0				,							_UpperCamelCase=0.1				,							_UpperCamelCase=False				,							_UpperCamelCase=1e-4				,							_UpperCamelCase=False				,							_UpperCamelCase=False				,							_UpperCamelCase=False				,							_UpperCamelCase=0.02				,							_UpperCamelCase=1e-5				,							_UpperCamelCase=32				,							_UpperCamelCase=None				,							_UpperCamelCase=None				,							**_UpperCamelCase				,							):
        super().__init__(**_UpperCamelCase					)

        _UpperCAmelCase           =   image_size
        _UpperCAmelCase           =   patch_size
        _UpperCAmelCase           =   num_channels
        _UpperCAmelCase           =   embed_dim
        _UpperCAmelCase           =   use_conv_embed
        _UpperCAmelCase           =   hidden_sizes
        _UpperCAmelCase           =   depths
        _UpperCAmelCase           =   focal_levels
        _UpperCAmelCase           =   focal_windows
        _UpperCAmelCase           =   hidden_act
        _UpperCAmelCase           =   mlp_ratio
        _UpperCAmelCase           =   hidden_dropout_prob
        _UpperCAmelCase           =   drop_path_rate
        _UpperCAmelCase           =   use_layerscale
        _UpperCAmelCase           =   layerscale_value
        _UpperCAmelCase           =   use_post_layernorm
        _UpperCAmelCase           =   use_post_layernorm_in_modulation
        _UpperCAmelCase           =   normalize_modulator
        _UpperCAmelCase           =   initializer_range
        _UpperCAmelCase           =   layer_norm_eps
        _UpperCAmelCase           =   encoder_stride
        _UpperCAmelCase           =   ['''stem'''] + [f'''stage{idx}''' for idx in range(1				,							len(self.depths					) + 1					)]
        _UpperCAmelCase       ,      _UpperCAmelCase           =   get_aligned_output_features_output_indices(
            out_features=_UpperCamelCase				,							out_indices=_UpperCamelCase				,							stage_names=self.stage_names					)






from ..utils import DummyObject, requires_backends




class 			__UpperCamelCase    (							metaclass=A__    ):
     __A	:  str							  =   ["""torch""", """scipy"""]





     def __init__(     self				,							*_UpperCamelCase				,							**_UpperCamelCase					):
        requires_backends(self				,							['''torch''', '''scipy''']					)





     @classmethod
     def 		UpperCamelCase(     cls				,							*_UpperCamelCase				,							**_UpperCamelCase					):
        requires_backends(cls				,							['''torch''', '''scipy''']					)





     @classmethod
     def 		UpperCamelCase(     cls				,							*_UpperCamelCase				,							**_UpperCamelCase					):
        requires_backends(cls				,							['''torch''', '''scipy''']					)