

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


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

lowerCamelCase			:				Optional[Any] 			=					{
    "microsoft/focalnet-tiny": "https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json",
}







class 							A__   (	A__					,       A__  ):
  A__					=    'focalnet'





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





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



'''simple docstring'''
from math import factorial


def 	_lowerCAmelCase (						_UpperCamelCase						:					int							,			_UpperCamelCase						:					int							,			_UpperCamelCase						:					float    )				->      float:
     """simple docstring"""




     if successes > trials:
          raise ValueError('successes must be lower or equal to trials'    )
     if trials < 0 or successes < 0:
          raise ValueError('the function is defined for non-negative integers'    )
     if not isinstance(_UpperCamelCase							,			_UpperCamelCase    ) or not isinstance(_UpperCamelCase							,			_UpperCamelCase    ):
          raise ValueError('the function is defined for non-negative integers'    )
     if not 0 < prob < 1:
          raise ValueError('prob has to be in range of 1 - 0'    )
     _SCREAMING_SNAKE_CASE							   =(prob**successes) * ((1 - prob) ** (trials - successes))
     # Calculate the binomial coefficient: n! / k!(n-k)!
     _SCREAMING_SNAKE_CASE							   =float(factorial(_UpperCamelCase    )    )
     coefficient /= factorial(_UpperCamelCase    ) * factorial(trials - successes    )
     return probability * coefficient


if __name__ == "__main__":
     from doctest import testmod

     testmod()
     print("Probability of 2 successes out of 4 trails")
     print("with probability of 0.75 is:", end=" ")
     print(binomial_distribution(2, 4, 0.7_5))
