



"""simple docstring"""





import unittest

import torch
from torch import nn

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







       '''simple docstring'''


       def 	lowercase__							(				self     :    Optional[int]       )					->		int:


             '''simple docstring'''




             UpperCAmelCase_     					=				get_activation("swish"       )

             self.assertIsInstance(_UpperCAmelCase						,							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     :    List[Any]       )					->		List[Any]:


             '''simple docstring'''




             UpperCAmelCase_     					=				get_activation("silu"       )

             self.assertIsInstance(_UpperCAmelCase						,							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     :    Union[str, Any]       )					->		Union[str, Any]:


             '''simple docstring'''




             UpperCAmelCase_     					=				get_activation("mish"       )

             self.assertIsInstance(_UpperCAmelCase						,							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     :    int       )					->		Dict:


             '''simple docstring'''




             UpperCAmelCase_     					=				get_activation("gelu"       )

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








'''simple docstring'''
def       a_				(	UpperCamelCase_ ):

							if length <= 0 or not isinstance(UpperCamelCase_						,  UpperCamelCase_ ):
														raise ValueError("Length must be a positive integer." )
							return [n * (2 * n - 1) for n in range(UpperCamelCase_ )]


if __name__ == "__main__":
							print(hexagonal_numbers(length=5))
							print(hexagonal_numbers(length=10))





