





'''simple docstring'''






from typing import List, Optional

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


lowerCAmelCase       		=      logging.get_logger(__name__)

lowerCAmelCase       		=      {
    """huggingface/autoformer-tourism-monthly""": """https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json""",
}
class 		lowerCamelCase  (      _A       ):
	snake_case_      =   "autoformer"
	snake_case_      =   {
	    "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_		,      ):
			# time series specific configuration
			lowerCAmelCase     :    Optional[Any]						=   prediction_length
			lowerCAmelCase     :    Dict						=   context_length if context_length is not None else prediction_length
			lowerCAmelCase     :    int						=   distribution_output
			lowerCAmelCase     :    Union[str, Any]						=   loss
			lowerCAmelCase     :    Optional[int]						=   input_size
			lowerCAmelCase     :    Optional[Any]						=   num_time_features
			lowerCAmelCase     :    List[str]						=   lags_sequence
			lowerCAmelCase     :    List[str]						=   scaling
			lowerCAmelCase     :    int						=   num_dynamic_real_features
			lowerCAmelCase     :    Optional[int]						=   num_static_real_features
			lowerCAmelCase     :    Any						=   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`"	)
					lowerCAmelCase     :    Tuple						=   cardinality
			else:
					lowerCAmelCase     :    Tuple						=   [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`"	)
					lowerCAmelCase     :    int						=   embedding_dimension
			else:
					lowerCAmelCase     :    List[str]						=   [min(50		,      (cat + 1) // 2	) for cat in self.cardinality]
			lowerCAmelCase     :    List[str]						=   num_parallel_samples

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

			lowerCAmelCase     :    Dict						=   dropout
			lowerCAmelCase     :    Any						=   attention_dropout
			lowerCAmelCase     :    List[str]						=   activation_dropout
			lowerCAmelCase     :    str						=   encoder_layerdrop
			lowerCAmelCase     :    Optional[int]						=   decoder_layerdrop

			lowerCAmelCase     :    List[str]						=   activation_function
			lowerCAmelCase     :    int						=   init_std

			lowerCAmelCase     :    List[Any]						=   use_cache

			# Autoformer
			lowerCAmelCase     :    Optional[Any]						=   label_length
			lowerCAmelCase     :    Optional[int]						=   moving_average
			lowerCAmelCase     :    Union[str, Any]						=   autocorrelation_factor

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





	@property
	def   _lowerCamelCase    (   self	):
			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'''






import numpy as np






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


if __name__ == "__main__":
					import doctest

					doctest.testmod()



