





'''simple docstring'''






import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
     import torch

     from transformers.activations import gelu_new, gelu_python, get_activation
@require_torch
class 		lowerCamelCase  (      unittest.TestCase       ):



 def   _lowerCamelCase    (   self	):
   lowerCAmelCase     :    List[str]						=   torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]	)
   lowerCAmelCase     :    Any						=   get_activation("gelu"	)
   self.assertTrue(torch.allclose(gelu_python(__snake_case	)		,      torch_builtin(__snake_case	)	)	)
   self.assertFalse(torch.allclose(gelu_python(__snake_case	)		,      gelu_new(__snake_case	)	)	)



 def   _lowerCamelCase    (   self	):
   lowerCAmelCase     :    int						=   torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]	)
   lowerCAmelCase     :    List[Any]						=   get_activation("gelu"	)
   lowerCAmelCase     :    Any						=   get_activation("gelu_10"	)

   lowerCAmelCase     :    int						=   torch_builtin(__snake_case	)
   lowerCAmelCase     :    Any						=   geluaa(__snake_case	)

   lowerCAmelCase     :    Dict						=   torch.where(y_gelu_aa < 10.0		,      1		,      0	)

   self.assertTrue(torch.max(__snake_case	).item() == 10.0	)
   self.assertTrue(torch.allclose(y_gelu * clipped_mask		,      y_gelu_aa * clipped_mask	)	)



 def   _lowerCamelCase    (   self	):
   get_activation("gelu"	)
   get_activation("gelu_10"	)
   get_activation("gelu_fast"	)
   get_activation("gelu_new"	)
   get_activation("gelu_python"	)
   get_activation("gelu_pytorch_tanh"	)
   get_activation("linear"	)
   get_activation("mish"	)
   get_activation("quick_gelu"	)
   get_activation("relu"	)
   get_activation("sigmoid"	)
   get_activation("silu"	)
   get_activation("swish"	)
   get_activation("tanh"	)
   with self.assertRaises(__snake_case	):
     get_activation("bogus"	)
   with self.assertRaises(__snake_case	):
     get_activation(__snake_case	)





 def   _lowerCamelCase    (   self	):
   lowerCAmelCase     :    List[Any]						=   get_activation("gelu"	)
   lowerCAmelCase     :    Optional[Any]						=   1
   lowerCAmelCase     :    List[str]						=   get_activation("gelu"	)
   self.assertEqual(acta.a		,      1	)
   with self.assertRaises(__snake_case	):
     lowerCAmelCase     :    Dict						=   acta.a










'''simple docstring'''






def      __A						(							a_						:  int      ,a_						:  int	):
		return abs(a_	) if a == 0 else greatest_common_divisor(b % a      ,a_	)






def      __A						(							a_						:  int      ,a_						:  int	):
		while y:  # --> when y=0 then loop will terminate and return x as final GCD.
				lowerCAmelCase	,		lowerCAmelCase     :    Tuple						=   y, x % y
		return abs(a_	)






def      __A						(							):
		try:
				lowerCAmelCase     :    Tuple						=   input("Enter two integers separated by comma (,): "	).split(","	)
				lowerCAmelCase     :    Tuple						=   int(nums[0]	)
				lowerCAmelCase     :    Tuple						=   int(nums[1]	)
				print(
				    f'''greatest_common_divisor({num_a}, {num_a}) = '''
				    f'''{greatest_common_divisor(a_      ,a_	)}'''	)
				print(f'''By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(a_      ,a_	)}'''	)
		except (IndexError, UnboundLocalError, ValueError):
				print("Wrong input"	)


if __name__ == "__main__":
					main()



