"""simple docstring"""







import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation



class  _lowerCamelCase			(unittest.TestCase     ):







				def 							__UpperCAmelCase					( self    :       Optional[Any]						):

					"""simple docstring"""






					_lowercase :    str							=							get_activation('swish'						)

					self.assertIsInstance(lowerCamelCase_			,					nn.SiLU						)

					self.assertEqual(act(torch.tensor(-1_0_0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertNotEqual(act(torch.tensor(-1			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(2_0			,					dtype=torch.floataa						)						).item()			,					2_0						)







				def 							__UpperCAmelCase					( self    :       Any						):

					"""simple docstring"""






					_lowercase :    List[str]							=							get_activation('silu'						)

					self.assertIsInstance(lowerCamelCase_			,					nn.SiLU						)

					self.assertEqual(act(torch.tensor(-1_0_0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertNotEqual(act(torch.tensor(-1			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(2_0			,					dtype=torch.floataa						)						).item()			,					2_0						)







				def 							__UpperCAmelCase					( self    :       Optional[Any]						):

					"""simple docstring"""






					_lowercase :    Tuple							=							get_activation('mish'						)

					self.assertIsInstance(lowerCamelCase_			,					nn.Mish						)

					self.assertEqual(act(torch.tensor(-2_0_0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertNotEqual(act(torch.tensor(-1			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(2_0			,					dtype=torch.floataa						)						).item()			,					2_0						)







				def 							__UpperCAmelCase					( self    :       int						):

					"""simple docstring"""






					_lowercase :    str							=							get_activation('gelu'						)

					self.assertIsInstance(lowerCamelCase_			,					nn.GELU						)

					self.assertEqual(act(torch.tensor(-1_0_0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertNotEqual(act(torch.tensor(-1			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(0			,					dtype=torch.floataa						)						).item()			,					0						)
					self.assertEqual(act(torch.tensor(2_0			,					dtype=torch.floataa						)						).item()			,					2_0						)




"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


SCREAMING_SNAKE_CASE									=						{
    'configuration_biogpt': ['BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BioGptConfig'],
    'tokenization_biogpt': ['BioGptTokenizer'],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						SCREAMING_SNAKE_CASE									=						[
						    'BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'BioGptForCausalLM',
						    'BioGptForTokenClassification',
						    'BioGptForSequenceClassification',
						    'BioGptModel',
						    'BioGptPreTrainedModel',
						]


if TYPE_CHECKING:
						from .configuration_biogpt import BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP, BioGptConfig
						from .tokenization_biogpt import BioGptTokenizer

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_biogpt import (
												    BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    BioGptForCausalLM,
												    BioGptForSequenceClassification,
												    BioGptForTokenClassification,
												    BioGptModel,
												    BioGptPreTrainedModel,
												)


else:
						import sys

						SCREAMING_SNAKE_CASE									=						_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



