






from ...utils import deprecate
from ..controlnet.multicontrolnet import MultiControlNetModel  # noqa: F401
from ..controlnet.pipeline_controlnet import StableDiffusionControlNetPipeline  # noqa: F401


deprecate(
    'stable diffusion controlnet',
    '0.22.0',
    'Importing `StableDiffusionControlNetPipeline` or `MultiControlNetModel` from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_controlnet is deprecated. Please import `from diffusers import StableDiffusionControlNetPipeline` instead.',
    standard_warn=False,
    stacklevel=3,
)









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





       """simple docstring"""







       def       _a   ( self							):
         UpperCamelCase_: Any   				=    torch.tensor([-1_0_0, -1, -0.1, 0, 0.1, 1.0, 1_0_0]							)
         UpperCamelCase_: List[str]   				=    get_activation('gelu'							)
         self.assertTrue(torch.allclose(gelu_python(_lowerCamelCase							)  ,      torch_builtin(_lowerCamelCase							)							)							)
         self.assertFalse(torch.allclose(gelu_python(_lowerCamelCase							)  ,      gelu_new(_lowerCamelCase							)							)							)





       def       _a   ( self							):
         UpperCamelCase_: Optional[Any]   				=    torch.tensor([-1_0_0, -1, -0.1, 0, 0.1, 1.0, 1_0_0]							)
         UpperCamelCase_: Union[str, Any]   				=    get_activation('gelu'							)
         UpperCamelCase_: int   				=    get_activation('gelu_10'							)

         UpperCamelCase_: Union[str, Any]   				=    torch_builtin(_lowerCamelCase							)
         UpperCamelCase_: List[str]   				=    geluaa(_lowerCamelCase							)

         UpperCamelCase_: Dict   				=    torch.where(y_gelu_aa < 1_0.0  ,      1  ,      0							)

         self.assertTrue(torch.max(_lowerCamelCase							).item() == 1_0.0							)
         self.assertTrue(torch.allclose(y_gelu * clipped_mask  ,      y_gelu_aa * clipped_mask							)							)





       def       _a   ( self							):
         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(_lowerCamelCase							):
           get_activation('bogus'							)
         with self.assertRaises(_lowerCamelCase							):
           get_activation(_lowerCamelCase							)





       def       _a   ( self							):
         UpperCamelCase_: str   				=    get_activation('gelu'							)
         UpperCamelCase_: str   				=    1
         UpperCamelCase_: int   				=    get_activation('gelu'							)
         self.assertEqual(acta.a  ,      1							)
         with self.assertRaises(_lowerCamelCase							):
           UpperCamelCase_: Tuple   				=    acta.a