

from typing import List, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_a:    Dict 							=			logging.get_logger(__name__)

_a:    Union[str, Any] 							=			{
    """huggingface/informer-tourism-monthly""": (
        """https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json"""
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}

class 						__UpperCamelCase    (					lowercase						):
 SCREAMING_SNAKE_CASE__    				=     'informer'
 SCREAMING_SNAKE_CASE__    				=     {
     'hidden_size': 'd_model',
     'num_attention_heads': 'encoder_attention_heads',
     'num_hidden_layers': 'encoder_layers',
 }




 def __init__(		self	:						Union[str, Any]		,	lowerCAmelCase	:						Optional[int] = None		,	lowerCAmelCase	:						Optional[int] = None		,	lowerCAmelCase	:						str = "student_t"		,	lowerCAmelCase	:						str = "nll"		,	lowerCAmelCase	:						int = 1		,	lowerCAmelCase	:						List[int] = None		,	lowerCAmelCase	:						Optional[Union[str, bool]] = "mean"		,	lowerCAmelCase	:						int = 0		,	lowerCAmelCase	:						int = 0		,	lowerCAmelCase	:						int = 0		,	lowerCAmelCase	:						int = 0		,	lowerCAmelCase	:						Optional[List[int]] = None		,	lowerCAmelCase	:						Optional[List[int]] = None		,	lowerCAmelCase	:						int = 64		,	lowerCAmelCase	:						int = 32		,	lowerCAmelCase	:						int = 32		,	lowerCAmelCase	:						int = 2		,	lowerCAmelCase	:						int = 2		,	lowerCAmelCase	:						int = 2		,	lowerCAmelCase	:						int = 2		,	lowerCAmelCase	:						bool = True		,	lowerCAmelCase	:						str = "gelu"		,	lowerCAmelCase	:						float = 0.05		,	lowerCAmelCase	:						float = 0.1		,	lowerCAmelCase	:						float = 0.1		,	lowerCAmelCase	:						float = 0.1		,	lowerCAmelCase	:						float = 0.1		,	lowerCAmelCase	:						int = 100		,	lowerCAmelCase	:						float = 0.02		,	lowerCAmelCase	:						List[str]=True		,	lowerCAmelCase	:						str = "prob"		,	lowerCAmelCase	:						int = 5		,	lowerCAmelCase	:						bool = True		,	**lowerCAmelCase	:						Optional[Any]		,	):


  '''simple docstring'''







  UpperCAmelCase_       				=			prediction_length
  UpperCAmelCase_       				=			context_length or prediction_length
  UpperCAmelCase_       				=			distribution_output
  UpperCAmelCase_       				=			loss
  UpperCAmelCase_       				=			input_size
  UpperCAmelCase_       				=			num_time_features
  UpperCAmelCase_       				=			lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
  UpperCAmelCase_       				=			scaling
  UpperCAmelCase_       				=			num_dynamic_real_features
  UpperCAmelCase_       				=			num_static_real_features
  UpperCAmelCase_       				=			num_static_categorical_features

  # set cardinality
  if cardinality and num_static_categorical_features > 0:
   if len(__A							) != num_static_categorical_features:
    raise ValueError(
        "The cardinality should be a list of the same length as `num_static_categorical_features`"							)
   UpperCAmelCase_       				=			cardinality
  else:
   UpperCAmelCase_       				=			[0]

  # set embedding_dimension
  if embedding_dimension and num_static_categorical_features > 0:
   if len(__A							) != num_static_categorical_features:
    raise ValueError(
        "The embedding dimension should be a list of the same length as `num_static_categorical_features`"							)
   UpperCAmelCase_       				=			embedding_dimension
  else:
   UpperCAmelCase_       				=			[min(50		,	(cat + 1) // 2							) for cat in self.cardinality]

  UpperCAmelCase_       				=			num_parallel_samples

  # Transformer architecture configuration
  UpperCAmelCase_       				=			input_size * len(self.lags_sequence							) + self._number_of_features
  UpperCAmelCase_       				=			d_model
  UpperCAmelCase_       				=			encoder_attention_heads
  UpperCAmelCase_       				=			decoder_attention_heads
  UpperCAmelCase_       				=			encoder_ffn_dim
  UpperCAmelCase_       				=			decoder_ffn_dim
  UpperCAmelCase_       				=			encoder_layers
  UpperCAmelCase_       				=			decoder_layers

  UpperCAmelCase_       				=			dropout
  UpperCAmelCase_       				=			attention_dropout
  UpperCAmelCase_       				=			activation_dropout
  UpperCAmelCase_       				=			encoder_layerdrop
  UpperCAmelCase_       				=			decoder_layerdrop

  UpperCAmelCase_       				=			activation_function
  UpperCAmelCase_       				=			init_std

  UpperCAmelCase_       				=			use_cache

  # Informer
  UpperCAmelCase_       				=			attention_type
  UpperCAmelCase_       				=			sampling_factor
  UpperCAmelCase_       				=			distil

  super().__init__(is_encoder_decoder=__A		,	**__A							)




 @property
 def       __A					(		self	:						Optional[int]							):


  '''simple docstring'''







  return (
      sum(self.embedding_dimension							)
      + self.num_dynamic_real_features
      + self.num_time_features
      + self.num_static_real_features
      + self.input_size * 2  # the log1p(abs(loc)) and log(scale) features
  )


from collections.abc import Sequence



def       __lowerCAmelCase      (						A       ,     A = False    ):
	if not arr:
		return 0

	UpperCAmelCase_       				=			0 if allow_empty_subarrays else float("-inf"    )
	UpperCAmelCase_       				=			0.0
	for num in arr:
		UpperCAmelCase_       				=			max(0 if allow_empty_subarrays else num       ,     curr_sum + num    )
		UpperCAmelCase_       				=			max(A       ,     A    )

	return max_sum


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

				testmod()

				_a:    Any 							=			[-2, 1, -3, 4, -1, 2, 1, -5, 4]
				print(F'{max_subarray_sum(nums) = }')