





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


_lowerCamelCase   				=			logging.get_logger(__name__)

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




class   UpperCamelCase_       (     UpperCamelCase__				,  UpperCamelCase__    ):
							lowerCamelCase_           =					"focalnet"


							def __init__(							self    :Optional[int]							,				__A    :str=224							,				__A    :List[Any]=4							,				__A    :List[Any]=3							,				__A    :Optional[Any]=96							,				__A    :Optional[Any]=False							,				__A    :Union[str, Any]=[192, 384, 768, 768]							,				__A    :Dict=[2, 2, 6, 2]							,				__A    :Union[str, Any]=[2, 2, 2, 2]							,				__A    :str=[3, 3, 3, 3]							,				__A    :Optional[Any]="gelu"							,				__A    :Tuple=4.0							,				__A    :List[str]=0.0							,				__A    :str=0.1							,				__A    :int=False							,				__A    :Optional[Any]=1E-4							,				__A    :List[str]=False							,				__A    :str=False							,				__A    :List[str]=False							,				__A    :Optional[int]=0.0_2							,				__A    :Union[str, Any]=1E-5							,				__A    :Tuple=32							,				__A    :Optional[Any]=None							,				__A    :str=None							,				**__A    :Optional[Any]							,				)   ->   Optional[int]:



									"""simple docstring"""



									super().__init__(**__A		)

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






from math import pow, sqrt






def 				SCREAMING_SNAKE_CASE__							(       *UpperCamelCase__:							float    ):
		SCREAMING_SNAKE_CASE__			=      len(UpperCamelCase__    ) > 0 and all(value > 0.0 for value in values    )
		return result






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							float					,   UpperCamelCase__:							float    ):
		return (
		    round(sqrt(molar_mass_a / molar_mass_a    )					,   6    )
		    if validate(UpperCamelCase__					,   UpperCamelCase__    )
		    else ValueError("""Input Error: Molar mass values must greater than 0."""    )
		)






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							float					,   UpperCamelCase__:							float					,   UpperCamelCase__:							float    ):
		return (
		    round(effusion_rate * sqrt(molar_mass_a / molar_mass_a    )					,   6    )
		    if validate(UpperCamelCase__					,   UpperCamelCase__					,   UpperCamelCase__    )
		    else ValueError(
		        """Input Error: Molar mass and effusion rate values must greater than 0."""    )
		)






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							float					,   UpperCamelCase__:							float					,   UpperCamelCase__:							float    ):
		return (
		    round(effusion_rate / sqrt(molar_mass_a / molar_mass_a    )					,   6    )
		    if validate(UpperCamelCase__					,   UpperCamelCase__					,   UpperCamelCase__    )
		    else ValueError(
		        """Input Error: Molar mass and effusion rate values must greater than 0."""    )
		)






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							float					,   UpperCamelCase__:							float					,   UpperCamelCase__:							float    ):
		return (
		    round(molar_mass / pow(effusion_rate_a / effusion_rate_a					,   2    )					,   6    )
		    if validate(UpperCamelCase__					,   UpperCamelCase__					,   UpperCamelCase__    )
		    else ValueError(
		        """Input Error: Molar mass and effusion rate values must greater than 0."""    )
		)






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							float					,   UpperCamelCase__:							float					,   UpperCamelCase__:							float    ):
		return (
		    round(pow(effusion_rate_a / effusion_rate_a					,   2    ) / molar_mass					,   6    )
		    if validate(UpperCamelCase__					,   UpperCamelCase__					,   UpperCamelCase__    )
		    else ValueError(
		        """Input Error: Molar mass and effusion rate values must greater than 0."""    )
		)