





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    _UpperCAmelCase							(		lowercase_     ):
      a						       =							'''informer'''
      a						       =							{
          '''hidden_size''': '''d_model''',
          '''num_attention_heads''': '''encoder_attention_heads''',
          '''num_hidden_layers''': '''encoder_layers''',
      }
      def __init__(		self      ,       a__ = None      ,       a__ = None      ,       a__ = "student_t"      ,       a__ = "nll"      ,       a__ = 1      ,       a__ = None      ,       a__ = "mean"      ,       a__ = 0      ,       a__ = 0      ,       a__ = 0      ,       a__ = 0      ,       a__ = None      ,       a__ = None      ,       a__ = 64      ,       a__ = 32      ,       a__ = 32      ,       a__ = 2      ,       a__ = 2      ,       a__ = 2      ,       a__ = 2      ,       a__ = True      ,       a__ = "gelu"      ,       a__ = 0.05      ,       a__ = 0.1      ,       a__ = 0.1      ,       a__ = 0.1      ,       a__ = 0.1      ,       a__ = 100      ,       a__ = 0.02      ,       a__=True      ,       a__ = "prob"      ,       a__ = 5      ,       a__ = True      ,       **a__      ,       ):
         A_     :				List[Any]			      =	prediction_length
         A_     :				Tuple			      =	context_length or prediction_length
         A_     :				Dict			      =	distribution_output
         A_     :				Optional[Any]			      =	loss
         A_     :				Optional[Any]			      =	input_size
         A_     :				Dict			      =	num_time_features
         A_     :				Dict			      =	lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
         A_     :				Optional[int]			      =	scaling
         A_     :				List[Any]			      =	num_dynamic_real_features
         A_     :				str			      =	num_static_real_features
         A_     :				Union[str, 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`"""       )
            A_     :				Optional[Any]			      =	cardinality
         else:
            A_     :				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_     :				List[str]			      =	embedding_dimension
         else:
            A_     :				Union[str, Any]			      =	[min(50      ,       (cat + 1) // 2       ) for cat in self.cardinality]

         A_     :				Optional[int]			      =	num_parallel_samples

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

         A_     :				List[Any]			      =	dropout
         A_     :				Tuple			      =	attention_dropout
         A_     :				Any			      =	activation_dropout
         A_     :				Dict			      =	encoder_layerdrop
         A_     :				Tuple			      =	decoder_layerdrop

         A_     :				Tuple			      =	activation_function
         A_     :				Any			      =	init_std

         A_     :				Dict			      =	use_cache

         # Informer
         A_     :				List[Any]			      =	attention_type
         A_     :				Tuple			      =	sampling_factor
         A_     :				Any			      =	distil

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






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













def     _lowerCAmelCase		(  _lowerCAmelCase     ):
   '''simple docstring'''


   A_     :				Union[str, Any]			      =	[0] * len(_lowerCAmelCase     )
   A_     :				Optional[int]			      =	[]
   A_     :				str			      =	[]
   A_     :				Dict			      =	0

   for values in graph.values():
      for i in values:
         indegree[i] += 1

   for i in range(len(_lowerCAmelCase     )     ):
      if indegree[i] == 0:
         queue.append(_lowerCAmelCase     )

   while queue:
      A_     :				List[str]			      =	queue.pop(0     )
      cnt += 1
      topo.append(_lowerCAmelCase     )
      for x in graph[vertex]:
         indegree[x] -= 1
         if indegree[x] == 0:
            queue.append(_lowerCAmelCase     )

   if cnt != len(_lowerCAmelCase     ):
      print("""Cycle exists"""     )
   else:
      print(_lowerCAmelCase     )


# Adjacency List of Graph
_lowerCAmelCase 				=     {0: [1, 2], 1: [3], 2: [3], 3: [4, 5], 4: [], 5: []}







topological_sort(graph)






