

'''simple docstring'''






from typing import List, Optional, Union

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


lowerCAmelCase__											=	logging.get_logger(__name__)

lowerCAmelCase__											=	{
    '''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_	(lowerCamelCase__      ):




  """simple docstring"""




  SCREAMING_SNAKE_CASE    :  Any							=			'informer'
  SCREAMING_SNAKE_CASE    :  Optional[Any]							=			{
      'hidden_size': 'd_model',
      'num_attention_heads': 'encoder_attention_heads',
      'num_hidden_layers': 'encoder_layers',
  }






  def __init__(      self   :     Tuple					,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 = 6_4					,lowercase__   :     int = 3_2					,lowercase__   :     int = 3_2					,lowercase__   :     int = 2					,lowercase__   :     int = 2					,lowercase__   :     int = 2					,lowercase__   :     int = 2					,lowercase__   :     bool = True					,lowercase__   :     str = "gelu"					,lowercase__   :     float = 0.0_5					,lowercase__   :     float = 0.1					,lowercase__   :     float = 0.1					,lowercase__   :     float = 0.1					,lowercase__   :     float = 0.1					,lowercase__   :     int = 1_0_0					,lowercase__   :     float = 0.0_2					,lowercase__   :     Any=True					,lowercase__   :     str = "prob"					,lowercase__   :     int = 5					,lowercase__   :     bool = True					,**lowercase__   :     List[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(5_0					,(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 					SCREAMING_SNAKE_CASE      (      self   :     List[Any]			):
   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'''






import colorsys

from PIL import Image  # type: ignore


def 		_A     (    A__     ,				A__     ,				A__      ):






 """simple docstring"""



 __lowercase							  = x
 __lowercase							  = y
 for step in range(A__      ):  # noqa: B007
  __lowercase							  = a * a - b * b + x
  __lowercase							  = 2 * a * b + y
  __lowercase							  = a_new

  # divergence happens for all complex number with an absolute value
  # greater than 4
  if a * a + b * b > 4:
   break
 return step / (max_step - 1)


def 		_A     (    A__      ):






 """simple docstring"""



 if distance == 1:
  return (0, 0, 0)
 else:
  return (255, 255, 255)


def 		_A     (    A__      ):






 """simple docstring"""



 if distance == 1:
  return (0, 0, 0)
 else:
  return tuple(round(i * 255      ) for i in colorsys.hsv_to_rgb(A__     ,				1     ,				1      )      )


def 		_A     (    A__ = 800     ,				A__ = 600     ,				A__ = -0.6     ,				A__ = 0     ,				A__ = 3.2     ,				A__ = 50     ,				A__ = True     ,				):






 """simple docstring"""



 __lowercase							  = Image.new('''RGB'''     ,				(image_width, image_height)      )
 __lowercase							  = img.load()

 # loop through the image-coordinates
 for image_x in range(A__      ):
  for image_y in range(A__      ):
   # determine the figure-coordinates based on the image-coordinates
   __lowercase							  = figure_width / image_width * image_height
   __lowercase							  = figure_center_x + (image_x / image_width - 0.5) * figure_width
   __lowercase							  = figure_center_y + (image_y / image_height - 0.5) * figure_height

   __lowercase							  = get_distance(A__     ,				A__     ,				A__      )

   # color the corresponding pixel based on the selected coloring-function
   if use_distance_color_coding:
    __lowercase							  = get_color_coded_rgb(A__      )
   else:
    __lowercase							  = get_black_and_white_rgb(A__      )

 return img


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 # colored version, full figure
 lowerCAmelCase__											=	get_image()

 # uncomment for colored version, different section, zoomed in
 # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
 # figure_width = 0.8)

 # uncomment for black and white version, full figure
 # img = get_image(use_distance_color_coding = False)

 # uncomment to save the image
 # img.save("mandelbrot.png")

 img.show()

