



"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


A:   str								=		logging.get_logger(__name__)

A:   List[str]								=		{
    "microsoft/focalnet-tiny": "https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json",
}



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__      ,			UpperCAmelCase__ ):
   __lowerCAmelCase  :   List[Any]						=						'focalnet'

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





    '''simple docstring'''




    super().__init__(**_SCREAMING_SNAKE_CASE						)

    UpperCAmelCase	:					Union[str, Any]	=	image_size
    UpperCAmelCase	:					Union[str, Any]	=	patch_size
    UpperCAmelCase	:					Any	=	num_channels
    UpperCAmelCase	:					Optional[int]	=	embed_dim
    UpperCAmelCase	:					List[str]	=	use_conv_embed
    UpperCAmelCase	:					Dict	=	hidden_sizes
    UpperCAmelCase	:					Any	=	depths
    UpperCAmelCase	:					str	=	focal_levels
    UpperCAmelCase	:					Tuple	=	focal_windows
    UpperCAmelCase	:					Tuple	=	hidden_act
    UpperCAmelCase	:					Dict	=	mlp_ratio
    UpperCAmelCase	:					List[Any]	=	hidden_dropout_prob
    UpperCAmelCase	:					Dict	=	drop_path_rate
    UpperCAmelCase	:					Tuple	=	use_layerscale
    UpperCAmelCase	:					Dict	=	layerscale_value
    UpperCAmelCase	:					Optional[int]	=	use_post_layernorm
    UpperCAmelCase	:					Dict	=	use_post_layernorm_in_modulation
    UpperCAmelCase	:					Tuple	=	normalize_modulator
    UpperCAmelCase	:					List[Any]	=	initializer_range
    UpperCAmelCase	:					Union[str, Any]	=	layer_norm_eps
    UpperCAmelCase	:					List[Any]	=	encoder_stride
    UpperCAmelCase	:					Optional[Any]	=	["""stem"""] + [F"stage{idx}" for idx in range(1      ,     len(self.depths						) + 1						)]
    UpperCAmelCase	,		UpperCAmelCase	:					Any	=	get_aligned_output_features_output_indices(
        out_features=_SCREAMING_SNAKE_CASE      ,     out_indices=_SCREAMING_SNAKE_CASE      ,     stage_names=self.stage_names						)






'''simple docstring'''







from __future__ import annotations





def 						snake_case_							(_a	:							Dict    ,   _a	:							str    ,   _a	:							Optional[Any]    ,   _a	:							List[str]     ):  # noqa: E741
    while r - l > 1:
        UpperCAmelCase			       =		(l + r) // 2
        if v[m] >= key:
            UpperCAmelCase			       =		m
        else:
            UpperCAmelCase			       =		m  # noqa: E741
    return r





def 						snake_case_							(_a	:							list[int]     ):
    if len(_a     ) == 0:
        return 0

    UpperCAmelCase			       =		[0] * len(_a     )
    UpperCAmelCase			       =		1

    UpperCAmelCase			       =		v[0]

    for i in range(1    ,   len(_a     )     ):
        if v[i] < tail[0]:
            UpperCAmelCase			       =		v[i]
        elif v[i] > tail[length - 1]:
            UpperCAmelCase			       =		v[i]
            length += 1
        else:
            UpperCAmelCase			       =		v[i]

    return length


if __name__ == "__main__":
   import doctest

   doctest.testmod()




