"""simple docstring"""






from typing import List, Optional

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


__lowerCAmelCase    :       List[str]					     =logging.get_logger(__name__)

__lowerCAmelCase    :       Optional[Any]					     ={
    """huggingface/autoformer-tourism-monthly""": """https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json""",
}





class  _A						(       lowerCAmelCase	):
      snake_case__			:   Union[str, Any]							  =	'autoformer'
      snake_case__			:   List[str]							  =	{
          'hidden_size': 'd_model',
          'num_attention_heads': 'encoder_attention_heads',
          'num_hidden_layers': 'encoder_layers',
      }

      def __init__(						self		,       __lowerCAmelCase = None		,       __lowerCAmelCase = None		,       __lowerCAmelCase = "student_t"		,       __lowerCAmelCase = "nll"		,       __lowerCAmelCase = 1		,       __lowerCAmelCase = [1, 2, 3, 4, 5, 6, 7]		,       __lowerCAmelCase = True		,       __lowerCAmelCase = 0		,       __lowerCAmelCase = 0		,       __lowerCAmelCase = 0		,       __lowerCAmelCase = 0		,       __lowerCAmelCase = None		,       __lowerCAmelCase = None		,       __lowerCAmelCase = 64		,       __lowerCAmelCase = 2		,       __lowerCAmelCase = 2		,       __lowerCAmelCase = 2		,       __lowerCAmelCase = 2		,       __lowerCAmelCase = 32		,       __lowerCAmelCase = 32		,       __lowerCAmelCase = "gelu"		,       __lowerCAmelCase = 0.1		,       __lowerCAmelCase = 0.1		,       __lowerCAmelCase = 0.1		,       __lowerCAmelCase = 0.1		,       __lowerCAmelCase = 0.1		,       __lowerCAmelCase = 100		,       __lowerCAmelCase = 0.0_2		,       __lowerCAmelCase = True		,       __lowerCAmelCase=True		,       __lowerCAmelCase = 10		,       __lowerCAmelCase = 25		,       __lowerCAmelCase = 3		,       **__lowerCAmelCase		,       ):







            """simple docstring"""



            lowercase														=	prediction_length
            lowercase														=	context_length if context_length is not None else prediction_length
            lowercase														=	distribution_output
            lowercase														=	loss
            lowercase														=	input_size
            lowercase														=	num_time_features
            lowercase														=	lags_sequence
            lowercase														=	scaling
            lowercase														=	num_dynamic_real_features
            lowercase														=	num_static_real_features
            lowercase														=	num_static_categorical_features
            if cardinality is not None 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`"""						)
                  lowercase														=	cardinality
            else:
                  lowercase														=	[0]
            if embedding_dimension is not None 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`"""						)
                  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

            # Autoformer
            lowercase														=	label_length
            lowercase														=	moving_average
            lowercase														=	autocorrelation_factor

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







      @property
      def 				A__       (						self						):







            """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 decimal import Decimal, getcontext
from math import ceil, factorial


def 			UpperCAmelCase__       (				lowerCAmelCase__     :int		) ->    str:
      '''simple docstring'''


      if not isinstance(lowerCAmelCase__					,		lowerCAmelCase__		):
            raise TypeError("""Undefined for non-integers"""		)
      elif precision < 1:
            raise ValueError("""Undefined for non-natural numbers"""		)

      lowercase														=	precision
      lowercase														=	ceil(precision / 1_4		)
      lowercase														=	4_2_6_8_8_0 * Decimal(1_0_0_0_5		).sqrt()
      lowercase														=	1
      lowercase														=	1_3_5_9_1_4_0_9
      lowercase														=	Decimal(lowerCAmelCase__		)
      for k in range(1					,		lowerCAmelCase__		):
            lowercase														=	factorial(6 * k		) // (factorial(3 * k		) * factorial(lowerCAmelCase__		) ** 3)
            linear_term += 5_4_5_1_4_0_1_3_4
            exponential_term *= -2_6_2_5_3_7_4_1_2_6_4_0_7_6_8_0_0_0
            partial_sum += Decimal(multinomial_term * linear_term		) / exponential_term
      return str(constant_term / partial_sum		)[:-1]


if __name__ == "__main__":
       __lowerCAmelCase    :       List[Any]					     =5_0
       print(F"""The first {n} digits of pi is: {pi(n)}""")



