






import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation
class       _UpperCAmelCase					(       unittest.TestCase	):

				"""simple docstring"""




				def 				lowercase__   (     self						:    Dict  ):

								'''simple docstring'''
								lowercase__    =			get_activation('''swish'''  )

								self.assertIsInstance(lowerCamelCase,  nn.SiLU  )

								self.assertEqual(act(torch.tensor(-100,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertNotEqual(act(torch.tensor(-1,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(0,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(20,  dtype=torch.floataa  )  ).item(),  20  )




				def 				lowercase__   (     self						:    Optional[Any]  ):

								'''simple docstring'''
								lowercase__    =			get_activation('''silu'''  )

								self.assertIsInstance(lowerCamelCase,  nn.SiLU  )

								self.assertEqual(act(torch.tensor(-100,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertNotEqual(act(torch.tensor(-1,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(0,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(20,  dtype=torch.floataa  )  ).item(),  20  )




				def 				lowercase__   (     self						:    str  ):

								'''simple docstring'''
								lowercase__    =			get_activation('''mish'''  )

								self.assertIsInstance(lowerCamelCase,  nn.Mish  )

								self.assertEqual(act(torch.tensor(-200,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertNotEqual(act(torch.tensor(-1,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(0,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(20,  dtype=torch.floataa  )  ).item(),  20  )




				def 				lowercase__   (     self						:    Optional[int]  ):

								'''simple docstring'''
								lowercase__    =			get_activation('''gelu'''  )

								self.assertIsInstance(lowerCamelCase,  nn.GELU  )

								self.assertEqual(act(torch.tensor(-100,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertNotEqual(act(torch.tensor(-1,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(0,  dtype=torch.floataa  )  ).item(),  0  )
								self.assertEqual(act(torch.tensor(20,  dtype=torch.floataa  )  ).item(),  20  )












from math import asin, atan, cos, radians, sin, sqrt, tan

A__	:			Optional[int]			   = 637_8137.0
A__	:			List[str]			   = 635_6752.31_4245
A__	:			Union[str, Any]			   = 6_37_81_37






def   a			(						lowerCamelCase_		,   lowerCamelCase_		,   lowerCamelCase_		,   lowerCamelCase_				):






				'''simple docstring'''
				lowercase__    =			(AXIS_A - AXIS_B) / AXIS_A
				lowercase__    =			atan((1 - flattening) * tan(radians(lowerCamelCase_				)				)				)
				lowercase__    =			atan((1 - flattening) * tan(radians(lowerCamelCase_				)				)				)
				lowercase__    =			radians(lowerCamelCase_				)
				lowercase__    =			radians(lowerCamelCase_				)
				# Equation
				lowercase__    =			sin((phi_a - phi_a) / 2				)
				lowercase__    =			sin((lambda_a - lambda_a) / 2				)
				# Square both values
				sin_sq_phi *= sin_sq_phi
				sin_sq_lambda *= sin_sq_lambda
				lowercase__    =			sqrt(sin_sq_phi + (cos(lowerCamelCase_				) * cos(lowerCamelCase_				) * sin_sq_lambda)				)
				return 2 * RADIUS * asin(lowerCamelCase_				)


if __name__ == "__main__":
							import doctest

							doctest.testmod()




