


"""simple docstring"""


import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation



class   _a      (      unittest.TestCase ):
    def      _UpperCamelCase       ( self							:					str				):
          lowerCamelCase__           =		get_activation('swish'				)

          self.assertIsInstance(SCREAMING_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      _UpperCamelCase       ( self							:					Union[str, Any]				):
          lowerCamelCase__           =		get_activation('silu'				)

          self.assertIsInstance(SCREAMING_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      _UpperCamelCase       ( self							:					Optional[Any]				):
          lowerCamelCase__           =		get_activation('mish'				)

          self.assertIsInstance(SCREAMING_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      _UpperCamelCase       ( self							:					Optional[Any]				):
          lowerCamelCase__           =		get_activation('gelu'				)

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







"""simple docstring"""


import warnings

from diffusers import StableDiffusionImgaImgPipeline  # noqa F401


warnings.warn(
    "The `image_to_image.py` script is outdated. Please use directly `from diffusers import"
    " StableDiffusionImg2ImgPipeline` instead."
)



