from typing import List, Optional

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


_lowercase:	int       			=		logging.get_logger(__name__)

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



class        lowerCamelCase__				(   UpperCAmelCase				):
			UpperCamelCase__    							="autoformer"
			UpperCamelCase__    							={
			    "hidden_size": "d_model",
			    "num_attention_heads": "encoder_attention_heads",
			    "num_hidden_layers": "encoder_layers",
			}





			def __init__(       self	:	Union[str, Any]  ,  lowercase__	:	Optional[int] = None  ,  lowercase__	:	Optional[int] = None  ,  lowercase__	:	str = "student_t"  ,  lowercase__	:	str = "nll"  ,  lowercase__	:	int = 1  ,  lowercase__	:	List[int] = [1, 2, 3, 4, 5, 6, 7]  ,  lowercase__	:	bool = True  ,  lowercase__	:	int = 0  ,  lowercase__	:	int = 0  ,  lowercase__	:	int = 0  ,  lowercase__	:	int = 0  ,  lowercase__	:	Optional[List[int]] = None  ,  lowercase__	:	Optional[List[int]] = None  ,  lowercase__	:	int = 64  ,  lowercase__	:	int = 2  ,  lowercase__	:	int = 2  ,  lowercase__	:	int = 2  ,  lowercase__	:	int = 2  ,  lowercase__	:	int = 32  ,  lowercase__	:	int = 32  ,  lowercase__	:	str = "gelu"  ,  lowercase__	:	float = 0.1  ,  lowercase__	:	float = 0.1  ,  lowercase__	:	float = 0.1  ,  lowercase__	:	float = 0.1  ,  lowercase__	:	float = 0.1  ,  lowercase__	:	int = 1_00  ,  lowercase__	:	float = 0.0_2  ,  lowercase__	:	bool = True  ,  lowercase__	:	int=True  ,  lowercase__	:	int = 10  ,  lowercase__	:	int = 25  ,  lowercase__	:	int = 3  ,  **lowercase__	:	List[Any]  ,  ):
										# time series specific configuration
										_lowerCAmelCase							=							prediction_length
										_lowerCAmelCase							=							context_length if context_length is not None else prediction_length
										_lowerCAmelCase							=							distribution_output
										_lowerCAmelCase							=							loss
										_lowerCAmelCase							=							input_size
										_lowerCAmelCase							=							num_time_features
										_lowerCAmelCase							=							lags_sequence
										_lowerCAmelCase							=							scaling
										_lowerCAmelCase							=							num_dynamic_real_features
										_lowerCAmelCase							=							num_static_real_features
										_lowerCAmelCase							=							num_static_categorical_features
										if cardinality is not None 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							=							cardinality
										else:
																	_lowerCAmelCase							=							[0]
										if embedding_dimension is not None 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							=							embedding_dimension
										else:
																	_lowerCAmelCase							=							[min(50  ,  (cat + 1) // 2						) for cat in self.cardinality]
										_lowerCAmelCase							=							num_parallel_samples

										# Transformer architecture configuration
										_lowerCAmelCase							=							input_size * len(self.lags_sequence						) + self._number_of_features
										_lowerCAmelCase							=							d_model
										_lowerCAmelCase							=							encoder_attention_heads
										_lowerCAmelCase							=							decoder_attention_heads
										_lowerCAmelCase							=							encoder_ffn_dim
										_lowerCAmelCase							=							decoder_ffn_dim
										_lowerCAmelCase							=							encoder_layers
										_lowerCAmelCase							=							decoder_layers

										_lowerCAmelCase							=							dropout
										_lowerCAmelCase							=							attention_dropout
										_lowerCAmelCase							=							activation_dropout
										_lowerCAmelCase							=							encoder_layerdrop
										_lowerCAmelCase							=							decoder_layerdrop

										_lowerCAmelCase							=							activation_function
										_lowerCAmelCase							=							init_std

										_lowerCAmelCase							=							use_cache

										# Autoformer
										_lowerCAmelCase							=							label_length
										_lowerCAmelCase							=							moving_average
										_lowerCAmelCase							=							autocorrelation_factor

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





			@property
			def   SCREAMING_SNAKE_CASE__     (       self	:	Dict						):
										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 re






def _lowerCamelCase  (		snake_case  ):

							if len(re.findall('[ATCG]'     , snake_case  )  ) != len(snake_case  ):
														raise ValueError('Invalid Strand'  )

							return dna.translate(dna.maketrans('ATCG'     , 'TAGC'  )  )


if __name__ == "__main__":
				import doctest

				doctest.testmod()






