
import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation






class     UpperCAmelCase						(		unittest.TestCase					):



   def 							_SCREAMING_SNAKE_CASE  (self						:   Dict					)						->      int:


          '''simple docstring'''


          snake_case			:  Any     							= get_activation("swish"					)

          self.assertIsInstance(snake_case__       ,		nn.SiLU					)

          self.assertEqual(act(torch.tensor(-1_00       ,		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 							_SCREAMING_SNAKE_CASE  (self						:   Any					)						->      List[str]:


          '''simple docstring'''


          snake_case			:  Any     							= get_activation("silu"					)

          self.assertIsInstance(snake_case__       ,		nn.SiLU					)

          self.assertEqual(act(torch.tensor(-1_00       ,		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 							_SCREAMING_SNAKE_CASE  (self						:   Tuple					)						->      Union[str, Any]:


          '''simple docstring'''


          snake_case			:  Union[str, Any]     							= get_activation("mish"					)

          self.assertIsInstance(snake_case__       ,		nn.Mish					)

          self.assertEqual(act(torch.tensor(-2_00       ,		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 							_SCREAMING_SNAKE_CASE  (self						:   List[Any]					)						->      Tuple:


          '''simple docstring'''


          snake_case			:  str     							= get_activation("gelu"					)

          self.assertIsInstance(snake_case__       ,		nn.GELU					)

          self.assertEqual(act(torch.tensor(-1_00       ,		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					)







__lowerCamelCase				=			"""Tobias Carryer"""

from time import time






class     UpperCAmelCase						:



   def __init__(self						:   Dict       ,		snake_case__						:   Optional[Any]       ,		snake_case__						:   Optional[Any]       ,		snake_case__						:   str       ,		snake_case__						:   Optional[int]=int(time()					)					)						->      List[Any]:  # noqa: B008


          '''simple docstring'''


          snake_case			:  Dict     							= multiplier
          snake_case			:  Dict     							= increment
          snake_case			:  Union[str, Any]     							= modulo
          snake_case			:  Tuple     							= seed



   def 							_SCREAMING_SNAKE_CASE  (self						:   List[Any]					)						->      Any:


          '''simple docstring'''


          snake_case			:  Optional[int]     							= (self.multiplier * self.seed + self.increment) % self.modulo
          return self.seed


if __name__ == "__main__":
   # Show the LCG in action.
   __lowerCamelCase				=			LinearCongruentialGenerator(1_66_45_25, 10_13_90_42_23, 2 << 31)
   while True:
      print(lcg.next_number())





