






"""simple docstring"""






from typing import List, Optional, Union

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


_lowercase				:				Optional[Any]   		=		logging.get_logger(__name__)

_lowercase				:				Any   		=		{
    "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  __SCREAMING_SNAKE_CASE			(   lowerCAmelCase_     ):


					'''simple docstring'''





					_a         =							'informer'
					_a         =							{
					    'hidden_size': 'd_model',
					    'num_attention_heads': 'encoder_attention_heads',
					    'num_hidden_layers': 'encoder_layers',
					}



					def __init__( self							:						str,						lowerCamelCase							:						Optional[int] = None,						lowerCamelCase							:						Optional[int] = None,						lowerCamelCase							:						str = "student_t",						lowerCamelCase							:						str = "nll",						lowerCamelCase							:						int = 1,						lowerCamelCase							:						List[int] = None,						lowerCamelCase							:						Optional[Union[str, bool]] = "mean",						lowerCamelCase							:						int = 0,						lowerCamelCase							:						int = 0,						lowerCamelCase							:						int = 0,						lowerCamelCase							:						int = 0,						lowerCamelCase							:						Optional[List[int]] = None,						lowerCamelCase							:						Optional[List[int]] = None,						lowerCamelCase							:						int = 64,						lowerCamelCase							:						int = 32,						lowerCamelCase							:						int = 32,						lowerCamelCase							:						int = 2,						lowerCamelCase							:						int = 2,						lowerCamelCase							:						int = 2,						lowerCamelCase							:						int = 2,						lowerCamelCase							:						bool = True,						lowerCamelCase							:						str = "gelu",						lowerCamelCase							:						float = 0.05,						lowerCamelCase							:						float = 0.1,						lowerCamelCase							:						float = 0.1,						lowerCamelCase							:						float = 0.1,						lowerCamelCase							:						float = 0.1,						lowerCamelCase							:						int = 100,						lowerCamelCase							:						float = 0.02,						lowerCamelCase							:						Optional[int]=True,						lowerCamelCase							:						str = "prob",						lowerCamelCase							:						int = 5,						lowerCamelCase							:						bool = True,						**lowerCamelCase							:						Union[str, Any],						)->      Optional[Any]:
								# time series specific configuration
								lowerCamelCase__	:	List[Any]				=prediction_length
								lowerCamelCase__	:	List[str]				=context_length or prediction_length
								lowerCamelCase__	:	Union[str, Any]				=distribution_output
								lowerCamelCase__	:	int				=loss
								lowerCamelCase__	:	List[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__	:	Optional[int]				=scaling
								lowerCamelCase__	:	List[str]				=num_dynamic_real_features
								lowerCamelCase__	:	Optional[int]				=num_static_real_features
								lowerCamelCase__	:	Any				=num_static_categorical_features

								# set cardinality
								if cardinality and num_static_categorical_features > 0:
											if len(lowerCamelCase  ) != 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__	:	Dict				=[0]

								# set embedding_dimension
								if embedding_dimension and num_static_categorical_features > 0:
											if len(lowerCamelCase  ) != num_static_categorical_features:
														raise ValueError(
														    '''The embedding dimension should be a list of the same length as `num_static_categorical_features`'''  )
											lowerCamelCase__	:	List[Any]				=embedding_dimension
								else:
											lowerCamelCase__	:	Dict				=[min(50,						(cat + 1) // 2  ) for cat in self.cardinality]

								lowerCamelCase__	:	Union[str, Any]				=num_parallel_samples

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

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

								lowerCamelCase__	:	Optional[int]				=activation_function
								lowerCamelCase__	:	int				=init_std

								lowerCamelCase__	:	Union[str, Any]				=use_cache

								# Informer
								lowerCamelCase__	:	Union[str, Any]				=attention_type
								lowerCamelCase__	:	Optional[Any]				=sampling_factor
								lowerCamelCase__	:	Optional[Any]				=distil

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




					@property
					def 	snake_case ( self							:						int  )->      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
								)









"""simple docstring"""






def   snake_case__     (	__lowerCamelCase       :					list[int]			):
			"""simple docstring"""
			if not numbers:
						return 0

			if not isinstance(__lowerCamelCase							,	(list, tuple)			) or not all(
			    isinstance(__lowerCamelCase							,	__lowerCamelCase			) for number in numbers			):
						raise ValueError('''numbers must be an iterable of integers'''			)

			lowerCamelCase__	:	Any				=numbers[0]

			for i in range(1							,	len(__lowerCamelCase			)			):
						# update the maximum and minimum subarray products
						lowerCamelCase__	:	Dict				=numbers[i]
						if number < 0:
									lowerCamelCase__			,     lowerCamelCase__	:	List[Any]				=min_till_now, max_till_now
						lowerCamelCase__	:	Optional[int]				=max(__lowerCamelCase							,	max_till_now * number			)
						lowerCamelCase__	:	Dict				=min(__lowerCamelCase							,	min_till_now * number			)

						# update the maximum product found till now
						lowerCamelCase__	:	Tuple				=max(__lowerCamelCase							,	__lowerCamelCase			)

			return max_prod




