


"""simple docstring"""







import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation






class 						_A  (  unittest.TestCase  ):







    """simple docstring"""




    def 	__snake_case							(					self				:    Union[str, Any]):
      a						:		List[str]      							=			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 	__snake_case							(					self				:    str):
      a						:		List[Any]      							=			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 	__snake_case							(					self				:    Optional[Any]):
      a						:		Any      							=			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 	__snake_case							(					self				:    Union[str, Any]):
      a						:		Optional[Any]      							=			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      lowercase			(				A_  ,   A_       )->      float:
  '''simple docstring'''







  if mass < 0:
    raise ValueError("The mass of a body cannot be negative"       )
  return 0.5 * mass * abs(A_       ) * abs(A_       )


if __name__ == "__main__":
 import doctest

 doctest.testmod(verbose=True)






