



"""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 SCREAMING_SNAKE_CASE__					(		unittest.TestCase      ):



						def     lowerCAmelCase__(self							):





													'''simple docstring'''

													__a		:		List[str]									=       torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]							)
													__a		:		Optional[Any]									=       get_activation("""gelu"""							)
													self.assertTrue(torch.allclose(gelu_python(_lowercase							)						,     torch_builtin(_lowercase							)							)							)
													self.assertFalse(torch.allclose(gelu_python(_lowercase							)						,     gelu_new(_lowercase							)							)							)



						def     lowerCAmelCase__(self							):





													'''simple docstring'''

													__a		:		Tuple									=       torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]							)
													__a		:		Optional[Any]									=       get_activation("""gelu"""							)
													__a		:		Optional[int]									=       get_activation("""gelu_10"""							)

													__a		:		str									=       torch_builtin(_lowercase							)
													__a		:		int									=       geluaa(_lowercase							)

													__a		:		Optional[int]									=       torch.where(y_gelu_aa < 10.0						,     1						,     0							)

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



						def     lowerCAmelCase__(self							):





													'''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(_lowercase							):
																				get_activation("""bogus"""							)
													with self.assertRaises(_lowercase							):
																				get_activation(_lowercase							)





						def     lowerCAmelCase__(self							):





													'''simple docstring'''

													__a		:		Dict									=       get_activation("""gelu"""							)
													__a		:		List[Any]									=       1
													__a		:		int									=       get_activation("""gelu"""							)
													self.assertEqual(acta.a						,     1							)
													with self.assertRaises(_lowercase							):
																				__a		:		List[str]									=       acta.a






"""simple docstring"""

from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import BaseOutput, is_torch_available, is_transformers_available




@dataclass
class SCREAMING_SNAKE_CASE__					(		__snake_case      ):
						_lowerCAmelCase							=					42
						_lowerCAmelCase							=					42


if is_transformers_available() and is_torch_available():
	from .pipeline_semantic_stable_diffusion import SemanticStableDiffusionPipeline

