






"""simple docstring"""





from typing import List, Optional, Union

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


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

_SCREAMING_SNAKE_CASE					:				List[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      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     str						= 'informer'
    SCREAMING_SNAKE_CASE						:     Optional[int]						= {
        'hidden_size': 'd_model',
        'num_attention_heads': 'encoder_attention_heads',
        'num_hidden_layers': 'encoder_layers',
    }






    def __init__(       self     :							Optional[int]       ,						__SCREAMING_SNAKE_CASE     :							Dict = None       ,						__SCREAMING_SNAKE_CASE     :							Dict = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = "student_t"       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = "nll"       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any] = 1       ,						__SCREAMING_SNAKE_CASE     :							Any = None       ,						__SCREAMING_SNAKE_CASE     :							List[Any] = "mean"       ,						__SCREAMING_SNAKE_CASE     :							List[str] = 0       ,						__SCREAMING_SNAKE_CASE     :							int = 0       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 0       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any] = 0       ,						__SCREAMING_SNAKE_CASE     :							Any = None       ,						__SCREAMING_SNAKE_CASE     :							List[str] = None       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any] = 64       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any] = 32       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any] = 32       ,						__SCREAMING_SNAKE_CASE     :							Tuple = 2       ,						__SCREAMING_SNAKE_CASE     :							Any = 2       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 2       ,						__SCREAMING_SNAKE_CASE     :							str = 2       ,						__SCREAMING_SNAKE_CASE     :							Dict = True       ,						__SCREAMING_SNAKE_CASE     :							str = "gelu"       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any] = 0.05       ,						__SCREAMING_SNAKE_CASE     :							Dict = 0.1       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any] = 0.1       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 0.1       ,						__SCREAMING_SNAKE_CASE     :							Tuple = 0.1       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any] = 100       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any] = 0.02       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=True       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any] = "prob"       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any] = 5       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any] = True       ,						**__SCREAMING_SNAKE_CASE     :							List[Any]       ,						)     ->		List[Any]:
      lowerCamelCase_         =						prediction_length
      lowerCamelCase_         =						context_length or prediction_length
      lowerCamelCase_         =						distribution_output
      lowerCamelCase_         =						loss
      lowerCamelCase_         =						input_size
      lowerCamelCase_         =						num_time_features
      lowerCamelCase_         =						lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
      lowerCamelCase_         =						scaling
      lowerCamelCase_         =						num_dynamic_real_features
      lowerCamelCase_         =						num_static_real_features
      lowerCamelCase_         =						num_static_categorical_features

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

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

      lowerCamelCase_         =						num_parallel_samples

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

      lowerCamelCase_         =						dropout
      lowerCamelCase_         =						attention_dropout
      lowerCamelCase_         =						activation_dropout
      lowerCamelCase_         =						encoder_layerdrop
      lowerCamelCase_         =						decoder_layerdrop

      lowerCamelCase_         =						activation_function
      lowerCamelCase_         =						init_std

      lowerCamelCase_         =						use_cache

      # Informer
      lowerCamelCase_         =						attention_type
      lowerCamelCase_         =						sampling_factor
      lowerCamelCase_         =						distil

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






    @property
    def    UpperCamelCase       (       self     :							Dict					)     ->		int:
      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
      )









'''simple docstring'''





def lowerCAmelCase  (__A):



     """simple docstring"""



     if not isinstance(__A  ,	__A):
          raise ValueError('''multiplicative_persistence() only accepts integral values''')
     if num < 0:
          raise ValueError('''multiplicative_persistence() does not accept negative values''')

     _a      =  0
     _a      =  str(__A)

     while len(__A) != 1:
          _a      =  [int(__A) for i in num_string]

          _a      =  1
          for i in range(0  ,	len(__A)):
               total *= numbers[i]

          _a      =  str(__A)

          steps += 1
     return steps




def lowerCAmelCase  (__A):



     """simple docstring"""



     if not isinstance(__A  ,	__A):
          raise ValueError('''additive_persistence() only accepts integral values''')
     if num < 0:
          raise ValueError('''additive_persistence() does not accept negative values''')

     _a      =  0
     _a      =  str(__A)

     while len(__A) != 1:
          _a      =  [int(__A) for i in num_string]

          _a      =  0
          for i in range(0  ,	len(__A)):
               total += numbers[i]

          _a      =  str(__A)

          steps += 1
     return steps


if __name__ == "__main__":
  import doctest

  doctest.testmod()



