



from typing import List, Optional

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


_snake_case		=  logging.get_logger(__name__)

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



class   UpperCAmelCase_    (       a):
							lowerCamelCase__   			=		'autoformer'
							lowerCamelCase__   			=		{
							    '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,			):

														'''simple docstring'''

														_lowerCAmelCase     :							Optional[int]    =    prediction_length
														_lowerCAmelCase     :							Any    =    context_length if context_length is not None else prediction_length
														_lowerCAmelCase     :							Optional[int]    =    distribution_output
														_lowerCAmelCase     :							Tuple    =    loss
														_lowerCAmelCase     :							List[Any]    =    input_size
														_lowerCAmelCase     :							List[Any]    =    num_time_features
														_lowerCAmelCase     :							Union[str, Any]    =    lags_sequence
														_lowerCAmelCase     :							Optional[int]    =    scaling
														_lowerCAmelCase     :							List[Any]    =    num_dynamic_real_features
														_lowerCAmelCase     :							str    =    num_static_real_features
														_lowerCAmelCase     :							Optional[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     :							Any    =    cardinality
														else:
																					_lowerCAmelCase     :							List[str]    =    [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     :							List[str]    =    embedding_dimension
														else:
																					_lowerCAmelCase     :							Union[str, Any]    =    [min(50,			(cat + 1) // 2) for cat in self.cardinality]
														_lowerCAmelCase     :							Any    =    num_parallel_samples

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

														_lowerCAmelCase     :							List[str]    =    dropout
														_lowerCAmelCase     :							List[Any]    =    attention_dropout
														_lowerCAmelCase     :							Dict    =    activation_dropout
														_lowerCAmelCase     :							Optional[Any]    =    encoder_layerdrop
														_lowerCAmelCase     :							Union[str, Any]    =    decoder_layerdrop

														_lowerCAmelCase     :							Dict    =    activation_function
														_lowerCAmelCase     :							Optional[Any]    =    init_std

														_lowerCAmelCase     :							List[Any]    =    use_cache

														# Autoformer
														_lowerCAmelCase     :							Tuple    =    label_length
														_lowerCAmelCase     :							List[str]    =    moving_average
														_lowerCAmelCase     :							str    =    autocorrelation_factor

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







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





def 				A				(					_lowerCamelCase				, _lowerCamelCase  ):





							'''simple docstring'''




							if density <= 0:
														raise ValueError("Impossible fluid density"  )
							if bulk_modulus <= 0:
														raise ValueError("Impossible bulk modulus"  )

							return (bulk_modulus / density) ** 0.5


if __name__ == "__main__":
						import doctest

						doctest.testmod()
