



'''simple docstring'''





import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
  import torch

  from transformers.activations import gelu_new, gelu_python, get_activation






@require_torch
class __A			(  unittest.TestCase						):



 '''simple docstring'''







 def 					a__  (self       )    ->     str:


      """simple docstring"""



      _a      =  torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]       )
      _a      =  get_activation('''gelu'''       )
      self.assertTrue(torch.allclose(gelu_python(snake_case_       ) ,   torch_builtin(snake_case_       )       )       )
      self.assertFalse(torch.allclose(gelu_python(snake_case_       ) ,   gelu_new(snake_case_       )       )       )



 def 					a__  (self       )    ->     Union[str, Any]:


      """simple docstring"""



      _a      =  torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]       )
      _a      =  get_activation('''gelu'''       )
      _a      =  get_activation('''gelu_10'''       )

      _a      =  torch_builtin(snake_case_       )
      _a      =  geluaa(snake_case_       )

      _a      =  torch.where(y_gelu_aa < 10.0 ,   1 ,   0       )

      self.assertTrue(torch.max(snake_case_       ).item() == 10.0       )
      self.assertTrue(torch.allclose(y_gelu * clipped_mask ,   y_gelu_aa * clipped_mask       )       )



 def 					a__  (self       )    ->     Optional[Any]:


      """simple docstring"""



      get_activation('''gelu'''       )
      get_activation('''gelu_10'''       )
      get_activation('''gelu_fast'''       )
      get_activation('''gelu_new'''       )
      get_activation('''gelu_python'''       )
      get_activation('''gelu_pytorch_tanh'''       )
      get_activation('''linear'''       )
      get_activation('''mish'''       )
      get_activation('''quick_gelu'''       )
      get_activation('''relu'''       )
      get_activation('''sigmoid'''       )
      get_activation('''silu'''       )
      get_activation('''swish'''       )
      get_activation('''tanh'''       )
      with self.assertRaises(snake_case_       ):
           get_activation('''bogus'''       )
      with self.assertRaises(snake_case_       ):
           get_activation(snake_case_       )



 def 					a__  (self       )    ->     List[str]:


      """simple docstring"""



      _a      =  get_activation('''gelu'''       )
      _a      =  1
      _a      =  get_activation('''gelu'''       )
      self.assertEqual(acta.a ,   1       )
      with self.assertRaises(snake_case_       ):
           _a      =  acta.a








'''simple docstring'''





__a          =		frozenset(
    [
        "prompt",
        "height",
        "width",
        "guidance_scale",
        "negative_prompt",
        "prompt_embeds",
        "negative_prompt_embeds",
        "cross_attention_kwargs",
    ]
)

__a          =		frozenset(["prompt", "negative_prompt"])

__a          =		frozenset([])

__a          =		frozenset(["image"])

__a          =		frozenset(
    [
        "image",
        "height",
        "width",
        "guidance_scale",
    ]
)

__a          =		frozenset(["image"])

__a          =		frozenset(
    [
        "prompt",
        "image",
        "height",
        "width",
        "guidance_scale",
        "negative_prompt",
        "prompt_embeds",
        "negative_prompt_embeds",
    ]
)

__a          =		frozenset(["prompt", "image", "negative_prompt"])

__a          =		frozenset(
    [
        # Text guided image variation with an image mask
        "prompt",
        "image",
        "mask_image",
        "height",
        "width",
        "guidance_scale",
        "negative_prompt",
        "prompt_embeds",
        "negative_prompt_embeds",
    ]
)

__a          =		frozenset(["prompt", "image", "mask_image", "negative_prompt"])

__a          =		frozenset(
    [
        # image variation with an image mask
        "image",
        "mask_image",
        "height",
        "width",
        "guidance_scale",
    ]
)

__a          =		frozenset(["image", "mask_image"])

__a          =		frozenset(
    [
        "example_image",
        "image",
        "mask_image",
        "height",
        "width",
        "guidance_scale",
    ]
)

__a          =		frozenset(["example_image", "image", "mask_image"])

__a          =		frozenset(["class_labels"])

__a          =		frozenset(["class_labels"])

__a          =		frozenset(["batch_size"])

__a          =		frozenset([])

__a          =		frozenset(["batch_size"])

__a          =		frozenset([])

__a          =		frozenset(
    [
        "prompt",
        "audio_length_in_s",
        "guidance_scale",
        "negative_prompt",
        "prompt_embeds",
        "negative_prompt_embeds",
        "cross_attention_kwargs",
    ]
)

__a          =		frozenset(["prompt", "negative_prompt"])
__a          =		frozenset(["input_tokens"])

__a          =		frozenset(["input_tokens"])
