




from __future__ import annotations

import time
from collections.abc import Sequence
from random import randint

from matplotlib import pyplot as plt



def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  if not arr:
    return None, None, 0
  if low == high:
    return low, high, arr[low]

  lowercase			:int							=  (low + high) // 2
  lowercase		,			lowercase		,			lowercase			:Dict							=  max_subarray(lowerCamelCase,	lowerCamelCase,	lowerCamelCase      )
  lowercase		,			lowercase		,			lowercase			:int							=  max_subarray(lowerCamelCase,	mid + 1,	lowerCamelCase      )
  lowercase		,			lowercase		,			lowercase			:str							=  max_cross_sum(lowerCamelCase,	lowerCamelCase,	lowerCamelCase,	lowerCamelCase      )
  if left_sum >= right_sum and left_sum >= cross_sum:
    return left_low, left_high, left_sum
  elif right_sum >= left_sum and right_sum >= cross_sum:
    return right_low, right_high, right_sum
  return cross_left, cross_right, cross_sum



def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  lowercase		,			lowercase			:Any							=  float("-inf"      ), -1
  lowercase		,			lowercase			:List[str]							=  float("-inf"      ), -1

  lowercase			:int | float							=  0
  for i in range(lowerCamelCase,	low - 1,	-1      ):
    summ += arr[i]
    if summ > left_sum:
      lowercase			:Optional[Any]							=  summ
      lowercase			:List[str]							=  i

  lowercase			:List[str]							=  0
  for i in range(mid + 1,	high + 1      ):
    summ += arr[i]
    if summ > right_sum:
      lowercase			:Tuple							=  summ
      lowercase			:Any							=  i

  return max_left, max_right, (left_sum + right_sum)



def 					UpperCAmelCase__     (   lowerCamelCase      ):
  lowercase			:Dict							=  [randint(1,	lowerCamelCase      ) for _ in range(lowerCamelCase      )]
  lowercase			:Tuple							=  time.time()
  max_subarray(lowerCamelCase,	0,	input_size - 1      )
  lowercase			:int							=  time.time()
  return end - start



def 					UpperCAmelCase__     (   ):
  lowercase			:Any							=  [10, 100, 1000, 10000, 50000, 100000, 200000, 300000, 400000, 500000]
  lowercase			:Dict							=  [time_max_subarray(lowerCamelCase      ) for input_size in input_sizes]
  print("No of Inputs\t\tTime Taken"      )
  for input_size, runtime in zip(lowerCamelCase,	lowerCamelCase      ):
    print(lowerCamelCase,	"\t\t",	lowerCamelCase      )
  plt.plot(lowerCamelCase,	lowerCamelCase      )
  plt.xlabel("Number of Inputs"      )
  plt.ylabel("Time taken in seconds"      )
  plt.show()


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

     testmod()









from __future__ import annotations

from typing import Dict

from ...configuration_utils import PretrainedConfig


_UpperCAmelCase		:  Tuple	=   {
    "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json",
    "susnato/ernie-m-large_pytorch": "https://huggingface.co/susnato/ernie-m-large_pytorch/blob/main/config.json",
}




class       __lowerCAmelCase				(							lowerCAmelCase):
       _a           =  '''ernie_m'''
       _a           =  {"dropout": "classifier_dropout", "num_classes": "num_labels"}






       def __init__(      self:    List[Any]				,    _lowerCAmelCase:    int = 25_00_02				,    _lowerCAmelCase:    int = 7_68				,    _lowerCAmelCase:    int = 12				,    _lowerCAmelCase:    int = 12				,    _lowerCAmelCase:    int = 30_72				,    _lowerCAmelCase:    str = "gelu"				,    _lowerCAmelCase:    float = 0.1				,    _lowerCAmelCase:    float = 0.1				,    _lowerCAmelCase:    int = 5_14				,    _lowerCAmelCase:    float = 0.02				,    _lowerCAmelCase:    int = 1				,    _lowerCAmelCase:    float = 1e-0_5				,    _lowerCAmelCase:    Dict=None				,    _lowerCAmelCase:    Optional[int]=False				,    _lowerCAmelCase:    List[str]=0.0				,    **_lowerCAmelCase:    Tuple				,    ):
         super().__init__(pad_token_id=_lowerCAmelCase				,    **_lowerCAmelCase )
         lowercase			:Tuple							=  vocab_size
         lowercase			:List[str]							=  hidden_size
         lowercase			:Optional[int]							=  num_hidden_layers
         lowercase			:Optional[Any]							=  num_attention_heads
         lowercase			:Optional[Any]							=  intermediate_size
         lowercase			:Optional[Any]							=  hidden_act
         lowercase			:Any							=  hidden_dropout_prob
         lowercase			:int							=  attention_probs_dropout_prob
         lowercase			:Dict							=  max_position_embeddings
         lowercase			:Optional[Any]							=  initializer_range
         lowercase			:Any							=  layer_norm_eps
         lowercase			:Union[str, Any]							=  classifier_dropout
         lowercase			:int							=  is_decoder
         lowercase			:List[str]							=  act_dropout



