code: 
  
  
  import unittest
  
  import numpy as np
  
  from transformers import is_tf_available
  from transformers.testing_utils import require_tf
  
  
  if is_tf_available():
   import tensorflow as tf
  
   from transformers.activations_tf import get_tf_activation
  
  @require_tf
  class 						A__      (					unittest.TestCase			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def 	a_    ( self					):
           snake_case					=       tf.constant([-1_0_0, -1.0, -0.1, 0, 0.1, 1.0, 100.0]					)
           snake_case					=       get_tf_activation('''gelu'''					)
           snake_case					=       get_tf_activation('''gelu_10'''					)
  
           snake_case					=       gelu(__snake_case					)
           snake_case					=       geluaa(__snake_case					)
  
           snake_case					=       tf.where(y_gelu_aa < 10.0    ,      1.0    ,      0.0					)
  
           self.assertEqual(tf.math.reduce_max(__snake_case					).numpy().item()    ,      10.0					)
           self.assertTrue(np.allclose(y_gelu * clipped_mask    ,      y_gelu_aa * clipped_mask					)					)
  
  
  
  
      def 	a_    ( self					):
           get_tf_activation('''gelu'''					)
           get_tf_activation('''gelu_10'''					)
           get_tf_activation('''gelu_fast'''					)
           get_tf_activation('''gelu_new'''					)
           get_tf_activation('''glu'''					)
           get_tf_activation('''mish'''					)
           get_tf_activation('''quick_gelu'''					)
           get_tf_activation('''relu'''					)
           get_tf_activation('''sigmoid'''					)
           get_tf_activation('''silu'''					)
           get_tf_activation('''swish'''					)
           get_tf_activation('''tanh'''					)
           with self.assertRaises(__snake_case					):
                get_tf_activation('''bogus'''					)
           with self.assertRaises(__snake_case					):
                get_tf_activation(__snake_case					)
  
  
  
  
  
style_context: 
  
  
  from ..utils import deprecate
  from .attention_processor import (  # noqa: F401
      Attention,
      AttentionProcessor,
      AttnAddedKVProcessor,
      AttnProcessor2_0,
      LoRAAttnProcessor,
      LoRALinearLayer,
      LoRAXFormersAttnProcessor,
      SlicedAttnAddedKVProcessor,
      SlicedAttnProcessor,
      XFormersAttnProcessor,
  )
  from .attention_processor import AttnProcessor as AttnProcessorRename  # noqa: F401
  
  
  deprecate(
      "cross_attention",
      "0.20.0",
      "Importing from cross_attention is deprecated. Please import from diffusers.models.attention_processor instead.",
      standard_warn=False,
  )
  
  
  _SCREAMING_SNAKE_CASE    :				Optional[int]       =					AttentionProcessor
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  
  
  class 						A__      (					snake_case__			):
  
  
  
  
  
  
  
      """simple docstring"""
  
      def __init__( self    ,      *__snake_case    ,      **__snake_case					):
           snake_case					=       F'''{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"					)					)} instead.'''
           deprecate('''cross_attention'''    ,      '''0.20.0'''    ,      __snake_case    ,      standard_warn=__snake_case					)
           super().__init__(*__snake_case    ,      **__snake_case					)
  
  
  
  
  