


"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available


lowerCAmelCase__      				=   {}

try:
     if not is_sentencepiece_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     lowerCAmelCase__      				=   ['''GPTSw3Tokenizer''']


if TYPE_CHECKING:
     try:
          if not is_sentencepiece_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_gpt_swa import GPTSwaTokenizer

else:
     import sys

     lowerCAmelCase__      				=   _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)









"""simple docstring"""







import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation


class       SCREAMING_SNAKE_CASE__				(		unittest.TestCase				):
       """simple docstring"""


       def        lowercase__							(						self						):






         """simple docstring"""





         lowerCAmelCase     :     int								=							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        lowercase__							(						self						):






         """simple docstring"""





         lowerCAmelCase     :     Union[str, Any]								=							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        lowercase__							(						self						):






         """simple docstring"""





         lowerCAmelCase     :     Dict								=							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        lowercase__							(						self						):






         """simple docstring"""





         lowerCAmelCase     :     Union[str, Any]								=							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						)





