






from typing import List, Optional, Union

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


_a     : Tuple   	=      logging.get_logger(__name__)

_a     : Optional[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	(	_A		):




      """simple docstring"""



      A    =     '''informer'''
      A    =     {
          '''hidden_size''': '''d_model''',
          '''num_attention_heads''': '''encoder_attention_heads''',
          '''num_hidden_layers''': '''encoder_layers''',
      }
      def __init__( self     ,						_lowerCAmelCase = None     ,						_lowerCAmelCase = None     ,						_lowerCAmelCase = "student_t"     ,						_lowerCAmelCase = "nll"     ,						_lowerCAmelCase = 1     ,						_lowerCAmelCase = None     ,						_lowerCAmelCase = "mean"     ,						_lowerCAmelCase = 0     ,						_lowerCAmelCase = 0     ,						_lowerCAmelCase = 0     ,						_lowerCAmelCase = 0     ,						_lowerCAmelCase = None     ,						_lowerCAmelCase = None     ,						_lowerCAmelCase = 64     ,						_lowerCAmelCase = 32     ,						_lowerCAmelCase = 32     ,						_lowerCAmelCase = 2     ,						_lowerCAmelCase = 2     ,						_lowerCAmelCase = 2     ,						_lowerCAmelCase = 2     ,						_lowerCAmelCase = True     ,						_lowerCAmelCase = "gelu"     ,						_lowerCAmelCase = 0.05     ,						_lowerCAmelCase = 0.1     ,						_lowerCAmelCase = 0.1     ,						_lowerCAmelCase = 0.1     ,						_lowerCAmelCase = 0.1     ,						_lowerCAmelCase = 100     ,						_lowerCAmelCase = 0.02     ,						_lowerCAmelCase=True     ,						_lowerCAmelCase = "prob"     ,						_lowerCAmelCase = 5     ,						_lowerCAmelCase = True     ,						**_lowerCAmelCase     ,						):



          '''simple docstring'''
          lowerCAmelCase__ :int   				=					prediction_length
          lowerCAmelCase__ :str   				=					context_length or prediction_length
          lowerCAmelCase__ :Dict   				=					distribution_output
          lowerCAmelCase__ :Optional[Any]   				=					loss
          lowerCAmelCase__ :Any   				=					input_size
          lowerCAmelCase__ :Tuple   				=					num_time_features
          lowerCAmelCase__ :Optional[int]   				=					lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
          lowerCAmelCase__ :Dict   				=					scaling
          lowerCAmelCase__ :Optional[int]   				=					num_dynamic_real_features
          lowerCAmelCase__ :Dict   				=					num_static_real_features
          lowerCAmelCase__ :Optional[Any]   				=					num_static_categorical_features

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

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

          lowerCAmelCase__ :str   				=					num_parallel_samples

          # Transformer architecture configuration
          lowerCAmelCase__ :List[str]   				=					input_size * len(self.lags_sequence		) + self._number_of_features
          lowerCAmelCase__ :Any   				=					d_model
          lowerCAmelCase__ :List[str]   				=					encoder_attention_heads
          lowerCAmelCase__ :Tuple   				=					decoder_attention_heads
          lowerCAmelCase__ :List[str]   				=					encoder_ffn_dim
          lowerCAmelCase__ :Dict   				=					decoder_ffn_dim
          lowerCAmelCase__ :Tuple   				=					encoder_layers
          lowerCAmelCase__ :List[Any]   				=					decoder_layers

          lowerCAmelCase__ :Union[str, Any]   				=					dropout
          lowerCAmelCase__ :Optional[Any]   				=					attention_dropout
          lowerCAmelCase__ :List[str]   				=					activation_dropout
          lowerCAmelCase__ :int   				=					encoder_layerdrop
          lowerCAmelCase__ :int   				=					decoder_layerdrop

          lowerCAmelCase__ :Union[str, Any]   				=					activation_function
          lowerCAmelCase__ :Tuple   				=					init_std

          lowerCAmelCase__ :Dict   				=					use_cache

          # Informer
          lowerCAmelCase__ :Tuple   				=					attention_type
          lowerCAmelCase__ :Any   				=					sampling_factor
          lowerCAmelCase__ :List[Any]   				=					distil

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



      @property
      def       snake_case_   ( self		):



          '''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
          )






'''simple docstring'''

def 					__UpperCamelCase				(						lowercase__    :	int			):






     '''simple docstring'''





     if upper_limit < 0:
          raise ValueError('Limit for the Catalan sequence must be ≥ 0'			)

     __lowercase      		=[0] * (upper_limit + 1)

     # Base case: C(0) = C(1) = 1
     __lowercase      		=1
     if upper_limit > 0:
          __lowercase      		=1

     # Recurrence relation: C(i) = sum(C(j).C(i-j-1)), from j = 0 to i
     for i in range(2,       upper_limit + 1			):
          for j in range(lowercase__			):
               catalan_list[i] += catalan_list[j] * catalan_list[i - j - 1]

     return catalan_list


if __name__ == "__main__":
       print('''\n********* Catalan Numbers Using Dynamic Programming ************\n''')
       print('''\n*** Enter -1 at any time to quit ***''')
       print('''\nEnter the upper limit (≥ 0) for the Catalan number sequence: ''', end='''''')
       try:
              while True:
                     UpperCAmelCase					 =	int(input().strip())
                     if N < 0:
                            print('''\n********* Goodbye!! ************''')
                            break
                     else:
                            print(F'''The Catalan numbers from 0 through {N} are:''')
                            print(catalan_numbers(N))
                            print('''Try another upper limit for the sequence: ''', end='''''')
       except (NameError, ValueError):
              print('''\n********* Invalid input, goodbye! ************\n''')

       import doctest

       doctest.testmod()


