



"""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 	__SCREAMING_SNAKE_CASE     (				unittest.TestCase       ):


					'''simple docstring'''





					def 		snake_case	(	self							:  List[Any]					)-> int:
								lowerCamelCase__		:		List[Any]		     =torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]					)
								lowerCamelCase__		:		Any		     =get_activation('''gelu'''					)
								self.assertTrue(torch.allclose(gelu_python(lowerCamelCase					),  torch_builtin(lowerCamelCase					)					)					)
								self.assertFalse(torch.allclose(gelu_python(lowerCamelCase					),  gelu_new(lowerCamelCase					)					)					)



					def 		snake_case	(	self							:  str					)-> Optional[Any]:
								lowerCamelCase__		:		List[str]		     =torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]					)
								lowerCamelCase__		:		Any		     =get_activation('''gelu'''					)
								lowerCamelCase__		:		List[Any]		     =get_activation('''gelu_10'''					)

								lowerCamelCase__		:		Dict		     =torch_builtin(lowerCamelCase					)
								lowerCamelCase__		:		str		     =geluaa(lowerCamelCase					)

								lowerCamelCase__		:		str		     =torch.where(y_gelu_aa < 10.0,  1,  0					)

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



					def 		snake_case	(	self							:  Any					)-> int:
								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(lowerCamelCase					):
											get_activation('''bogus'''					)
								with self.assertRaises(lowerCamelCase					):
											get_activation(lowerCamelCase					)




					def 		snake_case	(	self							:  List[Any]					)-> List[Any]:
								lowerCamelCase__		:		List[str]		     =get_activation('''gelu'''					)
								lowerCamelCase__		:		Any		     =1
								lowerCamelCase__		:		Union[str, Any]		     =get_activation('''gelu'''					)
								self.assertEqual(acta.a,  1					)
								with self.assertRaises(lowerCamelCase					):
											lowerCamelCase__		:		Optional[Any]		     =acta.a









"""simple docstring"""






def 					snake_case__       (		__lowerCamelCase    :   int							,		__lowerCamelCase    :   int     ):
			"""simple docstring"""
			return int((input_a, input_a).count(0     ) != 0     )






def 					snake_case__       (		):
			"""simple docstring"""
			assert nand_gate(0							,		0     ) == 1
			assert nand_gate(0							,		1     ) == 1
			assert nand_gate(1							,		0     ) == 1
			assert nand_gate(1							,		1     ) == 0


if __name__ == "__main__":
		print(nand_gate(0, 0))
		print(nand_gate(0, 1))
		print(nand_gate(1, 0))
		print(nand_gate(1, 1))




