



from typing import List, Optional, Union

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


lowercase_						=       logging.get_logger(__name__)

lowercase_						=       {
    """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 			_snake_case     (   lowercase__):
				UpperCamelCase__			:   Dict       						="""informer"""
				UpperCamelCase__			:   int       						={
				    """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] = None,   __lowercase   :  Optional[Union[str, bool]] = "mean",   __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 = 32,   __lowercase   :  int = 32,   __lowercase   :  int = 2,   __lowercase   :  int = 2,   __lowercase   :  int = 2,   __lowercase   :  int = 2,   __lowercase   :  bool = True,   __lowercase   :  str = "gelu",   __lowercase   :  float = 0.05,   __lowercase   :  float = 0.1,   __lowercase   :  float = 0.1,   __lowercase   :  float = 0.1,   __lowercase   :  float = 0.1,   __lowercase   :  int = 100,   __lowercase   :  float = 0.02,   __lowercase   :  Any=True,   __lowercase   :  str = "prob",   __lowercase   :  int = 5,   __lowercase   :  bool = True,   **__lowercase   :  str,   ):
							# time series specific configuration
							lowercase__   					=			prediction_length
							lowercase__   					=			context_length or prediction_length
							lowercase__   					=			distribution_output
							lowercase__   					=			loss
							lowercase__   					=			input_size
							lowercase__   					=			num_time_features
							lowercase__   					=			lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
							lowercase__   					=			scaling
							lowercase__   					=			num_dynamic_real_features
							lowercase__   					=			num_static_real_features
							lowercase__   					=			num_static_categorical_features

							# set cardinality
							if cardinality 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`"  )
										lowercase__   					=			cardinality
							else:
										lowercase__   					=			[0]

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

							lowercase__   					=			num_parallel_samples

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

							lowercase__   					=			dropout
							lowercase__   					=			attention_dropout
							lowercase__   					=			activation_dropout
							lowercase__   					=			encoder_layerdrop
							lowercase__   					=			decoder_layerdrop

							lowercase__   					=			activation_function
							lowercase__   					=			init_std

							lowercase__   					=			use_cache

							# Informer
							lowercase__   					=			attention_type
							lowercase__   					=			sampling_factor
							lowercase__   					=			distil

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




				@property
				def 							A__ (  self   :  Tuple  ):
							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 math import sqrt

import numpy as np
from sympy import symbols

# Coefficient
# Speed of light (m/s)
lowercase_						=       2_9979_2458

# Symbols
lowercase_			,      lowercase_			,      lowercase_			,      lowercase_						=       symbols("""ct x y z""")



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_					):
			if velocity > c:
						raise ValueError("Speed must not exceed light speed 299,792,458 [m/s]!"					)
			elif velocity < 1:
						# Usually the speed should be much higher than 1 (c order of magnitude)
						raise ValueError("Speed must be greater than or equal to 1!"					)

			return velocity / c



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_					):
			return 1 / sqrt(1 - beta(SCREAMING_SNAKE_CASE_					) ** 2					)



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_					):
			return np.array(
			    [
			        [gamma(SCREAMING_SNAKE_CASE_					), -gamma(SCREAMING_SNAKE_CASE_					) * beta(SCREAMING_SNAKE_CASE_					), 0, 0],
			        [-gamma(SCREAMING_SNAKE_CASE_					) * beta(SCREAMING_SNAKE_CASE_					), gamma(SCREAMING_SNAKE_CASE_					), 0, 0],
			        [0, 0, 1, 0],
			        [0, 0, 0, 1],
			    ]					)



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_ = None					):
			# Ensure event is not empty
			if event is None:
						lowercase__   					=			np.array([ct, x, y, z]					)  # Symbolic four vector
			else:
						event[0] *= c  # x0 is ct (speed of light * time)

			return transformation_matrix(SCREAMING_SNAKE_CASE_					) @ event


if __name__ == "__main__":
							import doctest

							doctest.testmod()

							# Example of symbolic vector:
							lowercase_						=       transform(2997_9245)
							print("""Example of four vector: """)
							print(F'ct\' = {four_vector[0]}')
							print(F'x\' = {four_vector[1]}')
							print(F'y\' = {four_vector[2]}')
							print(F'z\' = {four_vector[3]}')

							# Substitute symbols with numerical values
							lowercase_						=       {ct: c, x: 1, y: 1, z: 1}
							lowercase_						=       [four_vector[i].subs(sub_dict) for i in range(4)]

							print(F'\n{numerical_vector}')




