


from typing import List, Optional

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


_A		       =						logging.get_logger(__name__)

_A		       =						{
    'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json',
}






class     UpperCAmelCase__       (					A_		):



    """simple docstring"""






    UpperCAmelCase__						:		int      =  "autoformer"
    UpperCAmelCase__						:		List[Any]      =  {
        "hidden_size": "d_model",
        "num_attention_heads": "encoder_attention_heads",
        "num_hidden_layers": "encoder_layers",
    }






    def __init__(			self					,   A_ = None					,   A_ = None					,   A_ = "student_t"					,   A_ = "nll"					,   A_ = 1					,   A_ = [1, 2, 3, 4, 5, 6, 7]					,   A_ = True					,   A_ = 0					,   A_ = 0					,   A_ = 0					,   A_ = 0					,   A_ = None					,   A_ = None					,   A_ = 64					,   A_ = 2					,   A_ = 2					,   A_ = 2					,   A_ = 2					,   A_ = 32					,   A_ = 32					,   A_ = "gelu"					,   A_ = 0.1					,   A_ = 0.1					,   A_ = 0.1					,   A_ = 0.1					,   A_ = 0.1					,   A_ = 100					,   A_ = 0.02					,   A_ = True					,   A_=True					,   A_ = 10					,   A_ = 25					,   A_ = 3					,   **A_					,   )  ->       Union[str, Any]:
         # time series specific configuration
         __UpperCamelCase    							=prediction_length
         __UpperCamelCase    							=context_length if context_length is not None else prediction_length
         __UpperCamelCase    							=distribution_output
         __UpperCamelCase    							=loss
         __UpperCamelCase    							=input_size
         __UpperCamelCase    							=num_time_features
         __UpperCamelCase    							=lags_sequence
         __UpperCamelCase    							=scaling
         __UpperCamelCase    							=num_dynamic_real_features
         __UpperCamelCase    							=num_static_real_features
         __UpperCamelCase    							=num_static_categorical_features
         if cardinality is not None 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]
         if embedding_dimension is not None 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

         # Autoformer
         __UpperCamelCase    							=label_length
         __UpperCamelCase    							=moving_average
         __UpperCamelCase    							=autocorrelation_factor

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






    @property
    def _a					(			self    )  ->       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
         )












import numpy as np


def 	UpperCamelCase__(       UpperCamelCase__			:       np.array  )->np.array:
       return (2 / (1 + np.exp(-2 * vector  ))) - 1


if __name__ == "__main__":
       import doctest

       doctest.testmod()





