





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


					def 	lowerCamelCase       (					self			:Tuple		):
												A		=  torch.tensor([-1_00, -1, -0.1, 0, 0.1, 1.0, 1_00]		)
												A		=  get_activation("gelu"		)
												self.assertTrue(torch.allclose(gelu_python(__UpperCamelCase		)     ,       torch_builtin(__UpperCamelCase		)		)		)
												self.assertFalse(torch.allclose(gelu_python(__UpperCamelCase		)     ,       gelu_new(__UpperCamelCase		)		)		)


					def 	lowerCamelCase       (					self			:Union[str, Any]		):
												A		=  torch.tensor([-1_00, -1, -0.1, 0, 0.1, 1.0, 1_00]		)
												A		=  get_activation("gelu"		)
												A		=  get_activation("gelu_10"		)

												A		=  torch_builtin(__UpperCamelCase		)
												A		=  geluaa(__UpperCamelCase		)

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

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


					def 	lowerCamelCase       (					self			:Dict		):
												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(__UpperCamelCase		):
																			get_activation("bogus"		)
												with self.assertRaises(__UpperCamelCase		):
																			get_activation(__UpperCamelCase		)


					def 	lowerCamelCase       (					self			:str		):
												A		=  get_activation("gelu"		)
												A		=  1
												A		=  get_activation("gelu"		)
												self.assertEqual(acta.a     ,       1		)
												with self.assertRaises(__UpperCamelCase		):
																			A		=  acta.a









"""simple docstring"""
_snake_case     :		Optional[int]       						= [
    'DownloadConfig',
    'DownloadManager',
    'DownloadMode',
    'StreamingDownloadManager',
]

from .download_config import DownloadConfig
from .download_manager import DownloadManager, DownloadMode
from .streaming_download_manager import StreamingDownloadManager


