





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


UpperCAmelCase_					:   Any 							=						logging.get_logger(__name__)

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





class      lowercase__    (							__A     ,					__A  ):
  __UpperCamelCase	     =  """focalnet"""







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

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







from collections.abc import Sequence






def 							_lowerCAmelCase (  _a   :					Sequence[float]					,   _a   :					bool = False			)	->			float:
     if not arr:
          return 0

     lowerCAmelCase_					:       List[str]    =		0 if allow_empty_subarrays else float("""-inf"""			)
     lowerCAmelCase_					:       List[Any]    =		0.0
     for num in arr:
          lowerCAmelCase_					:       int    =		max(0 if allow_empty_subarrays else num					,   curr_sum + num			)
          lowerCAmelCase_					:       List[str]    =		max(_a					,   _a			)

     return max_sum


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

      testmod()

      UpperCAmelCase_					:   int 							=						[-2, 1, -3, 4, -1, 2, 1, -5, 4]
      print(F"""{max_subarray_sum(nums) = }""")
