

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       :							Union[str, Any]  ):
            A_	     =							tf.constant([-100, -1.0, -0.1, 0, 0.1, 1.0, 100.0]  )
            A_	     =							get_tf_activation("gelu"  )
            A_	     =							get_tf_activation("gelu_10"  )

            A_	     =							gelu(lowerCAmelCase_  )
            A_	     =							geluaa(lowerCAmelCase_  )

            A_	     =							tf.where(y_gelu_aa < 10.0	, 1.0	, 0.0  )

            self.assertEqual(tf.math.reduce_max(lowerCAmelCase_  ).numpy().item()	, 10.0  )
            self.assertTrue(np.allclose(y_gelu * clipped_mask	, y_gelu_aa * clipped_mask  )  )







      def 		__A  (      self       :							List[str]  ):
            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(lowerCAmelCase_  ):
                  get_tf_activation("bogus"  )
            with self.assertRaises(lowerCAmelCase_  ):
                  get_tf_activation(lowerCAmelCase_  )


import pytest

from datasets.utils.version import Version

@pytest.mark.parametrize(
    "other, expected_equality"							,[
        (Version("1.0.0"						), True),
        ("1.0.0", True),
        (Version("2.0.0"						), False),
        ("2.0.0", False),
        ("1", False),
        ("a", False),
        (1, False),
        (None, False),
    ]							,)
def 			__snake_case	(   __UpperCamelCase  :   Any							,__UpperCamelCase  :   List[Any]						):



      """simple docstring"""

      A_	     =							Version("1.0.0"						)
      assert (version == other) is expected_equality
      assert (version != other) is not expected_equality
      assert (hash(__UpperCamelCase						) == hash(__UpperCamelCase						)) is expected_equality