






'''simple docstring'''
import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


a_ 		=       logging.get_logger(__name__)

a_ 		=       {
    'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/config.json',
}






class    __SCREAMING_SNAKE_CASE					(	_UpperCAmelCase ):
 snake_case_     							=							"deta"
 snake_case_     							=							{
     "hidden_size": "d_model",
     "num_attention_heads": "encoder_attention_heads",
 }




 def __init__(					self		:							Union[str, Any]    ,					__lowercase		:							Optional[int]=None    ,					__lowercase		:							str=9_00    ,					__lowercase		:							str=20_48    ,					__lowercase		:							Tuple=6    ,					__lowercase		:							int=20_48    ,					__lowercase		:							Tuple=8    ,					__lowercase		:							Optional[Any]=6    ,					__lowercase		:							Optional[int]=10_24    ,					__lowercase		:							Dict=8    ,					__lowercase		:							Optional[Any]=0.0    ,					__lowercase		:							int=True    ,					__lowercase		:							Optional[Any]="relu"    ,					__lowercase		:							Any=2_56    ,					__lowercase		:							List[Any]=0.1    ,					__lowercase		:							Union[str, Any]=0.0    ,					__lowercase		:							Tuple=0.0    ,					__lowercase		:							Tuple=0.02    ,					__lowercase		:							Optional[Any]=1.0    ,					__lowercase		:							Union[str, Any]=True    ,					__lowercase		:							str=False    ,					__lowercase		:							Dict="sine"    ,					__lowercase		:							Union[str, Any]=5    ,					__lowercase		:							str=4    ,					__lowercase		:							Optional[int]=4    ,					__lowercase		:							Optional[Any]=True    ,					__lowercase		:							str=3_00    ,					__lowercase		:							Optional[int]=True    ,					__lowercase		:							Tuple=True    ,					__lowercase		:							Union[str, Any]=1    ,					__lowercase		:							str=5    ,					__lowercase		:							Union[str, Any]=2    ,					__lowercase		:							Tuple=1    ,					__lowercase		:							Tuple=1    ,					__lowercase		:							Optional[int]=5    ,					__lowercase		:							int=2    ,					__lowercase		:							Tuple=0.1    ,					__lowercase		:							Optional[Any]=0.25    ,					**__lowercase		:							Dict    ,					)		->  Optional[Any]:
       if backbone_config is None:
             logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'''					)
             SCREAMING_SNAKE_CASE__   : str													=CONFIG_MAPPING['''resnet'''](out_features=['''stage2''', '''stage3''', '''stage4''']					)
       else:
             if isinstance(_UpperCAmelCase    ,					_UpperCAmelCase					):
                   SCREAMING_SNAKE_CASE__   : Tuple													=backbone_config.pop('''model_type'''					)
                   SCREAMING_SNAKE_CASE__   : str													=CONFIG_MAPPING[backbone_model_type]
                   SCREAMING_SNAKE_CASE__   : Optional[int]													=config_class.from_dict(_UpperCAmelCase					)

       SCREAMING_SNAKE_CASE__   : int													=backbone_config
       SCREAMING_SNAKE_CASE__   : Any													=num_queries
       SCREAMING_SNAKE_CASE__   : List[str]													=max_position_embeddings
       SCREAMING_SNAKE_CASE__   : Optional[Any]													=d_model
       SCREAMING_SNAKE_CASE__   : List[Any]													=encoder_ffn_dim
       SCREAMING_SNAKE_CASE__   : Tuple													=encoder_layers
       SCREAMING_SNAKE_CASE__   : Dict													=encoder_attention_heads
       SCREAMING_SNAKE_CASE__   : Any													=decoder_ffn_dim
       SCREAMING_SNAKE_CASE__   : Union[str, Any]													=decoder_layers
       SCREAMING_SNAKE_CASE__   : List[Any]													=decoder_attention_heads
       SCREAMING_SNAKE_CASE__   : int													=dropout
       SCREAMING_SNAKE_CASE__   : List[str]													=attention_dropout
       SCREAMING_SNAKE_CASE__   : Tuple													=activation_dropout
       SCREAMING_SNAKE_CASE__   : Tuple													=activation_function
       SCREAMING_SNAKE_CASE__   : int													=init_std
       SCREAMING_SNAKE_CASE__   : Optional[Any]													=init_xavier_std
       SCREAMING_SNAKE_CASE__   : Optional[Any]													=encoder_layerdrop
       SCREAMING_SNAKE_CASE__   : Optional[int]													=auxiliary_loss
       SCREAMING_SNAKE_CASE__   : Union[str, Any]													=position_embedding_type
       # deformable attributes
       SCREAMING_SNAKE_CASE__   : List[str]													=num_feature_levels
       SCREAMING_SNAKE_CASE__   : Optional[Any]													=encoder_n_points
       SCREAMING_SNAKE_CASE__   : int													=decoder_n_points
       SCREAMING_SNAKE_CASE__   : str													=two_stage
       SCREAMING_SNAKE_CASE__   : Optional[int]													=two_stage_num_proposals
       SCREAMING_SNAKE_CASE__   : Tuple													=with_box_refine
       SCREAMING_SNAKE_CASE__   : str													=assign_first_stage
       if two_stage is True and with_box_refine is False:
             raise ValueError('''If two_stage is True, with_box_refine must be True.'''					)
       # Hungarian matcher
       SCREAMING_SNAKE_CASE__   : Union[str, Any]													=class_cost
       SCREAMING_SNAKE_CASE__   : Optional[int]													=bbox_cost
       SCREAMING_SNAKE_CASE__   : int													=giou_cost
       # Loss coefficients
       SCREAMING_SNAKE_CASE__   : Optional[int]													=mask_loss_coefficient
       SCREAMING_SNAKE_CASE__   : List[str]													=dice_loss_coefficient
       SCREAMING_SNAKE_CASE__   : str													=bbox_loss_coefficient
       SCREAMING_SNAKE_CASE__   : Union[str, Any]													=giou_loss_coefficient
       SCREAMING_SNAKE_CASE__   : Optional[int]													=eos_coefficient
       SCREAMING_SNAKE_CASE__   : str													=focal_alpha
       super().__init__(is_encoder_decoder=_UpperCAmelCase    ,					**_UpperCAmelCase					)




 @property
 def    __magic_name__		(					self		:							int					)		->  int:
       return self.encoder_attention_heads




 @property
 def    __magic_name__		(					self		:							int					)		->  Dict:
       return self.d_model




 def    __magic_name__		(					self		:							int					)		->  List[Any]:
       SCREAMING_SNAKE_CASE__   : Union[str, Any]													=copy.deepcopy(self.__dict__					)
       SCREAMING_SNAKE_CASE__   : Dict													=self.backbone_config.to_dict()
       SCREAMING_SNAKE_CASE__   : Union[str, Any]													=self.__class__.model_type
       return output
"""simple docstring"""






from collections.abc import Sequence



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase       ,    __UpperCAmelCase = False )  ->  float:
   if not arr:
      return 0

   lowercase__:   Any					=      0 if allow_empty_subarrays else float('''-inf''' )
   lowercase__:   Union[str, Any]					=      0.0
   for num in arr:
      lowercase__:   List[str]					=      max(0 if allow_empty_subarrays else num       ,    curr_sum + num )
      lowercase__:   int					=      max(__UpperCAmelCase       ,    __UpperCAmelCase )

   return max_sum


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

       testmod()

       __A			   = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
       print(f'''{max_subarray_sum(nums) = }''')
