



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowercase     							=						{
    '''configuration_megatron_bert''': ['''MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegatronBertConfig'''],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_lowercase     							=						[
				    '''MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''MegatronBertForCausalLM''',
				    '''MegatronBertForMaskedLM''',
				    '''MegatronBertForMultipleChoice''',
				    '''MegatronBertForNextSentencePrediction''',
				    '''MegatronBertForPreTraining''',
				    '''MegatronBertForQuestionAnswering''',
				    '''MegatronBertForSequenceClassification''',
				    '''MegatronBertForTokenClassification''',
				    '''MegatronBertModel''',
				    '''MegatronBertPreTrainedModel''',
				]

if TYPE_CHECKING:
				from .configuration_megatron_bert import MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, MegatronBertConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_megatron_bert import (
								    MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    MegatronBertForCausalLM,
								    MegatronBertForMaskedLM,
								    MegatronBertForMultipleChoice,
								    MegatronBertForNextSentencePrediction,
								    MegatronBertForPreTraining,
								    MegatronBertForQuestionAnswering,
								    MegatronBertForSequenceClassification,
								    MegatronBertForTokenClassification,
								    MegatronBertModel,
								    MegatronBertPreTrainedModel,
								)

else:
				import sys

				_lowercase     							=						_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)








from math import factorial, pi






def      _A				(UpperCamelCase		:      float      ,			UpperCamelCase		:      int = 30 )  ->float:



			'''simple docstring'''







			if not isinstance(UpperCamelCase      ,			(int, float) ):
						raise ValueError("""maclaurin_sin() requires either an int or float for theta""" )

			if not isinstance(UpperCamelCase      ,			UpperCamelCase ) or accuracy <= 0:
						raise ValueError("""maclaurin_sin() requires a positive int for accuracy""" )

			lowerCamelCase__ :      Dict								=		float(UpperCamelCase )
			lowerCamelCase__ :      int								=		theta // (2 * pi)
			theta -= 2 * div * pi
			return sum(
			    (-1) ** r * theta ** (2 * r + 1) / factorial(2 * r + 1 ) for r in range(UpperCamelCase ) )






def      _A				(UpperCamelCase		:      float      ,			UpperCamelCase		:      int = 30 )  ->float:



			'''simple docstring'''







			if not isinstance(UpperCamelCase      ,			(int, float) ):
						raise ValueError("""maclaurin_cos() requires either an int or float for theta""" )

			if not isinstance(UpperCamelCase      ,			UpperCamelCase ) or accuracy <= 0:
						raise ValueError("""maclaurin_cos() requires a positive int for accuracy""" )

			lowerCamelCase__ :      int								=		float(UpperCamelCase )
			lowerCamelCase__ :      Optional[int]								=		theta // (2 * pi)
			theta -= 2 * div * pi
			return sum((-1) ** r * theta ** (2 * r) / factorial(2 * r ) for r in range(UpperCamelCase ) )


if __name__ == "__main__":
				import doctest

				doctest.testmod()

				print(maclaurin_sin(10))
				print(maclaurin_sin(-10))
				print(maclaurin_sin(10, 15))
				print(maclaurin_sin(-10, 15))

				print(maclaurin_cos(5))
				print(maclaurin_cos(-5))
				print(maclaurin_cos(10, 15))
				print(maclaurin_cos(-10, 15))



