




from typing import List, Optional, Union

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


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

_lowerCamelCase  :			int        =       {
    '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        lowercase      (    __UpperCAmelCase):
				__lowerCAmelCase    :    Any         =   """informer"""
				__lowerCAmelCase    :    Dict         =   {
				    """hidden_size""": """d_model""",
				    """num_attention_heads""": """encoder_attention_heads""",
				    """num_hidden_layers""": """encoder_layers""",
				}







				def __init__(							self   :					List[Any]      ,     _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 = 1_00      ,     _lowerCamelCase   :					float = 0.02      ,     _lowerCamelCase   :					Optional[Any]=True      ,     _lowerCamelCase   :					str = "prob"      ,     _lowerCamelCase   :					int = 5      ,     _lowerCamelCase   :					bool = True      ,     **_lowerCamelCase   :					Any      ,     ):



					"""simple docstring"""

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

					A_  :				int	   =		num_parallel_samples

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

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

					A_  :				Union[str, Any]	   =		activation_function
					A_  :				Dict	   =		init_std

					A_  :				Optional[Any]	   =		use_cache

					# Informer
					A_  :				Any	   =		attention_type
					A_  :				Union[str, Any]	   =		sampling_factor
					A_  :				Dict	   =		distil

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







				@property
				def 					a_  (							self   :					Tuple       ):



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











"""simple docstring"""

from collections.abc import Generator
from math import sin

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	if len(_UpperCAmelCase	) != 32:
		raise ValueError('''Input must be of length 32'''	)

	A_  :				int	   =		b''''''
	for i in [3, 2, 1, 0]:
		little_endian += string_aa[8 * i : 8 * i + 8]
	return little_endian

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	if i < 0:
		raise ValueError('''Input must be non-negative'''	)

	A_  :				int	   =		format(_UpperCAmelCase  ,      '''08x'''	)[-8:]
	A_  :				Optional[Any]	   =		b''''''
	for i in [3, 2, 1, 0]:
		little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode('''utf-8'''	)
	return little_endian_hex

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	A_  :				int	   =		b''''''
	for char in message:
		bit_string += format(_UpperCAmelCase  ,      '''08b'''	).encode('''utf-8'''	)
	A_  :				Optional[Any]	   =		format(len(_UpperCAmelCase	)  ,      '''064b'''	).encode('''utf-8'''	)

	# Pad bit_string to a multiple of 512 chars
	bit_string += b"1"
	while len(_UpperCAmelCase	) % 512 != 448:
		bit_string += b"0"
	bit_string += to_little_endian(start_len[32:]	) + to_little_endian(start_len[:32]	)

	return bit_string

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	if len(_UpperCAmelCase	) % 512 != 0:
		raise ValueError('''Input must have length that\'s a multiple of 512'''	)

	for pos in range(0  ,      len(_UpperCAmelCase	)  ,      512	):
		A_  :				Union[str, Any]	   =		bit_string[pos : pos + 512]
		A_  :				Optional[int]	   =		[]
		for i in range(0  ,      512  ,      32	):
			block_words.append(int(to_little_endian(block[i : i + 32]	)  ,      2	)	)
		yield block_words

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	if i < 0:
		raise ValueError('''Input must be non-negative'''	)

	A_  :				str	   =		format(_UpperCAmelCase  ,      '''032b'''	)
	A_  :				List[str]	   =		''''''
	for c in i_str:
		new_str += "1" if c == "0" else "0"
	return int(_UpperCAmelCase  ,      2	)

def 		lowercase_      (		_UpperCAmelCase  ,      _UpperCAmelCase	):




	"""simple docstring"""






	return (a + b) % 2**32

def 		lowercase_      (		_UpperCAmelCase  ,      _UpperCAmelCase	):




	"""simple docstring"""






	if i < 0:
		raise ValueError('''Input must be non-negative'''	)
	if shift < 0:
		raise ValueError('''Shift must be non-negative'''	)
	return ((i << shift) ^ (i >> (32 - shift))) % 2**32

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	A_  :				Any	   =		preprocess(_UpperCAmelCase	)

	A_  :				Any	   =		[int(2**32 * abs(sin(i + 1	)	)	) for i in range(64	)]

	# Starting states
	A_  :				List[str]	   =		0x6_7_4_5_2_3_0_1
	A_  :				str	   =		0xe_f_c_d_a_b_8_9
	A_  :				Union[str, Any]	   =		0x9_8_b_a_d_c_f_e
	A_  :				Dict	   =		0x1_0_3_2_5_4_7_6

	A_  :				int	   =		[
	    7,
	    12,
	    17,
	    22,
	    7,
	    12,
	    17,
	    22,
	    7,
	    12,
	    17,
	    22,
	    7,
	    12,
	    17,
	    22,
	    5,
	    9,
	    14,
	    20,
	    5,
	    9,
	    14,
	    20,
	    5,
	    9,
	    14,
	    20,
	    5,
	    9,
	    14,
	    20,
	    4,
	    11,
	    16,
	    23,
	    4,
	    11,
	    16,
	    23,
	    4,
	    11,
	    16,
	    23,
	    4,
	    11,
	    16,
	    23,
	    6,
	    10,
	    15,
	    21,
	    6,
	    10,
	    15,
	    21,
	    6,
	    10,
	    15,
	    21,
	    6,
	    10,
	    15,
	    21,
	]

	# Process bit string in chunks, each with 16 32-char words
	for block_words in get_block_words(_UpperCAmelCase	):
		A_  :				str	   =		aa
		A_  :				Tuple	   =		ba
		A_  :				Tuple	   =		ca
		A_  :				int	   =		da

		# Hash current chunk
		for i in range(64	):
			if i <= 15:
				# f = (b & c) | (not_32(b) & d)     # Alternate definition for f
				A_  :				str	   =		d ^ (b & (c ^ d))
				A_  :				int	   =		i
			elif i <= 31:
				# f = (d & b) | (not_32(d) & c)     # Alternate definition for f
				A_  :				List[Any]	   =		c ^ (d & (b ^ c))
				A_  :				Optional[int]	   =		(5 * i + 1) % 16
			elif i <= 47:
				A_  :				Optional[Any]	   =		b ^ c ^ d
				A_  :				List[Any]	   =		(3 * i + 5) % 16
			else:
				A_  :				Dict	   =		c ^ (b | not_aa(_UpperCAmelCase	))
				A_  :				Dict	   =		(7 * i) % 16
			A_  :				Optional[int]	   =		(f + a + added_consts[i] + block_words[g]) % 2**32
			A_  :				List[str]	   =		d
			A_  :				str	   =		c
			A_  :				Tuple	   =		b
			A_  :				Tuple	   =		sum_aa(_UpperCAmelCase  ,      left_rotate_aa(_UpperCAmelCase  ,      shift_amounts[i]	)	)

		# Add hashed chunk to running total
		A_  :				str	   =		sum_aa(_UpperCAmelCase  ,      _UpperCAmelCase	)
		A_  :				int	   =		sum_aa(_UpperCAmelCase  ,      _UpperCAmelCase	)
		A_  :				int	   =		sum_aa(_UpperCAmelCase  ,      _UpperCAmelCase	)
		A_  :				Optional[Any]	   =		sum_aa(_UpperCAmelCase  ,      _UpperCAmelCase	)

	A_  :				Dict	   =		reformat_hex(_UpperCAmelCase	) + reformat_hex(_UpperCAmelCase	) + reformat_hex(_UpperCAmelCase	) + reformat_hex(_UpperCAmelCase	)
	return digest


if __name__ == "__main__":
		import doctest

		doctest.testmod()





