





from typing import List, Optional

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


_lowerCAmelCase				:   Dict						       =						logging.get_logger(__name__)

_lowerCAmelCase				:   Union[str, Any]						       =						{
    '''huggingface/autoformer-tourism-monthly''': '''https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json''',
}


class        __magic_name__	(				lowerCamelCase__				):





     """simple docstring"""



     __UpperCamelCase            =  '''autoformer'''
     __UpperCamelCase            =  {
         '''hidden_size''': '''d_model''',
         '''num_attention_heads''': '''encoder_attention_heads''',
         '''num_hidden_layers''': '''encoder_layers''',
     }



     def __init__(				self							:Dict      ,   snake_case							:Optional[int] = None      ,   snake_case							:Optional[int] = None      ,   snake_case							:str = "student_t"      ,   snake_case							:str = "nll"      ,   snake_case							:int = 1      ,   snake_case							:List[int] = [1, 2, 3, 4, 5, 6, 7]      ,   snake_case							:bool = True      ,   snake_case							:int = 0      ,   snake_case							:int = 0      ,   snake_case							:int = 0      ,   snake_case							:int = 0      ,   snake_case							:Optional[List[int]] = None      ,   snake_case							:Optional[List[int]] = None      ,   snake_case							:int = 64      ,   snake_case							:int = 2      ,   snake_case							:int = 2      ,   snake_case							:int = 2      ,   snake_case							:int = 2      ,   snake_case							:int = 32      ,   snake_case							:int = 32      ,   snake_case							:str = "gelu"      ,   snake_case							:float = 0.1      ,   snake_case							:float = 0.1      ,   snake_case							:float = 0.1      ,   snake_case							:float = 0.1      ,   snake_case							:float = 0.1      ,   snake_case							:int = 100      ,   snake_case							:float = 0.02      ,   snake_case							:bool = True      ,   snake_case							:Optional[Any]=True      ,   snake_case							:int = 10      ,   snake_case							:int = 25      ,   snake_case							:int = 3      ,   **snake_case							:str      ,   ):





        '''simple docstring'''




        A_       :					str        =      prediction_length
        A_       :					Tuple        =      context_length if context_length is not None else prediction_length
        A_       :					str        =      distribution_output
        A_       :					Union[str, Any]        =      loss
        A_       :					Optional[int]        =      input_size
        A_       :					str        =      num_time_features
        A_       :					Union[str, Any]        =      lags_sequence
        A_       :					int        =      scaling
        A_       :					int        =      num_dynamic_real_features
        A_       :					int        =      num_static_real_features
        A_       :					Dict        =      num_static_categorical_features
        if cardinality is not None and num_static_categorical_features > 0:
           if len(snake_case	) != num_static_categorical_features:
              raise ValueError(
                  "The cardinality should be a list of the same length as `num_static_categorical_features`"	)
           A_       :					Union[str, Any]        =      cardinality
        else:
           A_       :					Union[str, Any]        =      [0]
        if embedding_dimension is not None and num_static_categorical_features > 0:
           if len(snake_case	) != num_static_categorical_features:
              raise ValueError(
                  "The embedding dimension should be a list of the same length as `num_static_categorical_features`"	)
           A_       :					List[str]        =      embedding_dimension
        else:
           A_       :					int        =      [min(50      ,   (cat + 1) // 2	) for cat in self.cardinality]
        A_       :					Optional[int]        =      num_parallel_samples

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

        A_       :					str        =      dropout
        A_       :					str        =      attention_dropout
        A_       :					Any        =      activation_dropout
        A_       :					Any        =      encoder_layerdrop
        A_       :					Dict        =      decoder_layerdrop

        A_       :					Dict        =      activation_function
        A_       :					Dict        =      init_std

        A_       :					Tuple        =      use_cache

        # Autoformer
        A_       :					str        =      label_length
        A_       :					str        =      moving_average
        A_       :					Any        =      autocorrelation_factor

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





     @property
     def     SCREAMING_SNAKE_CASE		(				self							:Tuple	):





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







def   __snake_case    (       _lowerCAmelCase			:			int						)			->    bool:
   if num < 0:
      return False

   A_       :					int        =      num
   A_       :					int        =      0
   while num > 0:
      A_       :					str        =      rev_num * 10 + (num % 10)
      num //= 10

   return num_copy == rev_num


if __name__ == "__main__":
 import doctest

 doctest.testmod()
