



"""simple docstring"""






from typing import List, Optional, Union

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


__snake_case				:  Tuple =       logging.get_logger(__name__)

__snake_case				:  Dict =       {
    'huggingface/informer-tourism-monthly': (
        'https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json'
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}



class      A__  (    __snake_case				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      "informer"
	SCREAMING_SNAKE_CASE        =      {
	    "hidden_size": "d_model",
	    "num_attention_heads": "encoder_attention_heads",
	    "num_hidden_layers": "encoder_layers",
	}

	def __init__(	self:						Optional[int]			,     _SCREAMING_SNAKE_CASE:						Union[str, Any] = None			,     _SCREAMING_SNAKE_CASE:						List[str] = None			,     _SCREAMING_SNAKE_CASE:						Union[str, Any] = "student_t"			,     _SCREAMING_SNAKE_CASE:						Dict = "nll"			,     _SCREAMING_SNAKE_CASE:						int = 1			,     _SCREAMING_SNAKE_CASE:						Any = None			,     _SCREAMING_SNAKE_CASE:						Dict = "mean"			,     _SCREAMING_SNAKE_CASE:						Dict = 0			,     _SCREAMING_SNAKE_CASE:						Dict = 0			,     _SCREAMING_SNAKE_CASE:						int = 0			,     _SCREAMING_SNAKE_CASE:						Optional[int] = 0			,     _SCREAMING_SNAKE_CASE:						Dict = None			,     _SCREAMING_SNAKE_CASE:						List[Any] = None			,     _SCREAMING_SNAKE_CASE:						List[str] = 64			,     _SCREAMING_SNAKE_CASE:						Any = 32			,     _SCREAMING_SNAKE_CASE:						List[str] = 32			,     _SCREAMING_SNAKE_CASE:						str = 2			,     _SCREAMING_SNAKE_CASE:						List[Any] = 2			,     _SCREAMING_SNAKE_CASE:						Dict = 2			,     _SCREAMING_SNAKE_CASE:						str = 2			,     _SCREAMING_SNAKE_CASE:						Optional[int] = True			,     _SCREAMING_SNAKE_CASE:						str = "gelu"			,     _SCREAMING_SNAKE_CASE:						Optional[int] = 0.05			,     _SCREAMING_SNAKE_CASE:						Dict = 0.1			,     _SCREAMING_SNAKE_CASE:						Union[str, Any] = 0.1			,     _SCREAMING_SNAKE_CASE:						str = 0.1			,     _SCREAMING_SNAKE_CASE:						List[str] = 0.1			,     _SCREAMING_SNAKE_CASE:						Any = 100			,     _SCREAMING_SNAKE_CASE:						Optional[Any] = 0.02			,     _SCREAMING_SNAKE_CASE:						Dict=True			,     _SCREAMING_SNAKE_CASE:						Any = "prob"			,     _SCREAMING_SNAKE_CASE:						Tuple = 5			,     _SCREAMING_SNAKE_CASE:						Optional[Any] = True			,     **_SCREAMING_SNAKE_CASE:						Optional[int]			,     )							->			List[str]:

				"""simple docstring"""

				__lowerCAmelCase :    List[Any]				=			prediction_length
				__lowerCAmelCase :    str				=			context_length or prediction_length
				__lowerCAmelCase :    Union[str, Any]				=			distribution_output
				__lowerCAmelCase :    Optional[int]				=			loss
				__lowerCAmelCase :    Any				=			input_size
				__lowerCAmelCase :    Dict				=			num_time_features
				__lowerCAmelCase :    Any				=			lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
				__lowerCAmelCase :    Tuple				=			scaling
				__lowerCAmelCase :    str				=			num_dynamic_real_features
				__lowerCAmelCase :    Optional[Any]				=			num_static_real_features
				__lowerCAmelCase :    Optional[int]				=			num_static_categorical_features

				# set cardinality
				if cardinality 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 :    List[Any]				=			cardinality
				else:
							__lowerCAmelCase :    List[Any]				=			[0]

				# set embedding_dimension
				if embedding_dimension 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 :    Tuple				=			embedding_dimension
				else:
							__lowerCAmelCase :    List[Any]				=			[min(50			,     (cat + 1) // 2) for cat in self.cardinality]

				__lowerCAmelCase :    Optional[int]				=			num_parallel_samples

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

				__lowerCAmelCase :    Optional[Any]				=			dropout
				__lowerCAmelCase :    int				=			attention_dropout
				__lowerCAmelCase :    Dict				=			activation_dropout
				__lowerCAmelCase :    Union[str, Any]				=			encoder_layerdrop
				__lowerCAmelCase :    Dict				=			decoder_layerdrop

				__lowerCAmelCase :    List[Any]				=			activation_function
				__lowerCAmelCase :    List[str]				=			init_std

				__lowerCAmelCase :    Dict				=			use_cache

				# Informer
				__lowerCAmelCase :    Union[str, Any]				=			attention_type
				__lowerCAmelCase :    Tuple				=			sampling_factor
				__lowerCAmelCase :    Any				=			distil

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







	@property
	def 				_SCREAMING_SNAKE_CASE  (	self:						Dict)							->			Optional[Any]:

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







from __future__ import annotations



def  a__ (__lowercase							:list					,  __lowercase							:int | None = None					,  __lowercase							:int | None = None   )		-> None:
				if start is None:
								_A	:				Optional[int]   =      0

				if end is None:
								_A	:				Union[str, Any]   =      len(__lowercase   ) - 1

				if start >= end:
								return

				_A	:				Union[str, Any]   =      (start + end) // 2

				slowsort(__lowercase					,  __lowercase					,  __lowercase   )
				slowsort(__lowercase					,  mid + 1					,  __lowercase   )

				if sequence[end] < sequence[mid]:
								_A  ,				_A	:				Optional[int]   =      sequence[mid], sequence[end]

				slowsort(__lowercase					,  __lowercase					,  end - 1   )


if __name__ == "__main__":
	from doctest import testmod

	testmod()



