
import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation

class     _UpperCamelCase			(   unittest.TestCase					):






			'''simple docstring'''

			def  lowerCAmelCase__		(    self	:    Any ):
							UpperCamelCase_:							List[str]		=  get_activation("""swish""" )

							self.assertIsInstance(snake_case_  ,		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  lowerCAmelCase__		(    self	:    List[Any] ):
							UpperCamelCase_:							str		=  get_activation("""silu""" )

							self.assertIsInstance(snake_case_  ,		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  lowerCAmelCase__		(    self	:    Optional[int] ):
							UpperCamelCase_:							Any		=  get_activation("""mish""" )

							self.assertIsInstance(snake_case_  ,		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  lowerCAmelCase__		(    self	:    List[str] ):
							UpperCamelCase_:							List[str]		=  get_activation("""gelu""" )

							self.assertIsInstance(snake_case_  ,		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 )








def     A__   (  lowerCamelCase  )					->		list:
				return [
				    txt[:a] + txt[a].upper() + txt[a + 1 :]
				    for a in range(len(lowerCamelCase  )  )
				    if txt[a].isalpha()
				]


if __name__ == "__main__":
							__import__("""doctest""").testmod()






