"""simple docstring"""






import math

import tensorflow as tf
from packaging import version



def   a_						(					lowerCamelCase       ):
				UpperCAmelCase__             =							tf.convert_to_tensor(lowerCamelCase       )
				UpperCAmelCase__             =							0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0       )					,			x.dtype       )       ))

				return x * cdf



def   a_						(					lowerCamelCase       ):
				UpperCAmelCase__             =							tf.convert_to_tensor(lowerCamelCase       )
				UpperCAmelCase__             =							tf.cast(math.pi					,			x.dtype       )
				UpperCAmelCase__             =							tf.cast(0.044715					,			x.dtype       )
				UpperCAmelCase__             =							0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi       ) * (x + coeff * tf.pow(lowerCamelCase					,			3       ))       ))

				return x * cdf



def   a_						(					lowerCamelCase       ):
				UpperCAmelCase__             =							tf.convert_to_tensor(lowerCamelCase       )

				return x * tf.tanh(tf.math.softplus(lowerCamelCase       )       )



def   a_						(					lowerCamelCase       ):
				UpperCAmelCase__             =							tf.convert_to_tensor(lowerCamelCase       )
				UpperCAmelCase__             =							tf.cast(0.044715					,			x.dtype       )
				UpperCAmelCase__             =							tf.cast(0.7978845608					,			x.dtype       )

				return 0.5 * x * (1.0 + tf.tanh(x * coeffa * (1.0 + coeffa * x * x)       ))



def   a_						(					lowerCamelCase       ):
				UpperCAmelCase__             =							tf.convert_to_tensor(lowerCamelCase       )
				UpperCAmelCase__             =							tf.cast(1.702					,			x.dtype       )
				return x * tf.math.sigmoid(coeff * x       )



def   a_						(					lowerCamelCase       ):
				return tf.clip_by_value(_gelu(lowerCamelCase       )					,			-1_0					,			1_0       )



def   a_						(					lowerCamelCase					,			lowerCamelCase=-1       ):
				UpperCAmelCase__      ,	UpperCAmelCase__             =							tf.split(lowerCamelCase					,			2					,			axis=lowerCamelCase       )
				return a * tf.math.sigmoid(lowerCamelCase       )


if version.parse(tf.version.VERSION) >= version.parse('2.4'):



						def   a_						(					lowerCamelCase       ):
										return tf.keras.activations.gelu(lowerCamelCase					,			approximate=lowerCamelCase       )

						lowerCAmelCase__  :  str						     =	tf.keras.activations.gelu







						lowerCAmelCase__  :  Tuple						     =	approximate_gelu_wrap
else:
						lowerCAmelCase__  :  str						     =	_gelu
						lowerCAmelCase__  :  Optional[Any]						     =	_gelu_new


lowerCAmelCase__  :  Any						     =	{
    'gelu': gelu,
    'gelu_10': gelu_aa,
    'gelu_fast': gelu_fast,
    'gelu_new': gelu_new,
    'glu': glu,
    'mish': mish,
    'quick_gelu': quick_gelu,
    'relu': tf.keras.activations.relu,
    'sigmoid': tf.keras.activations.sigmoid,
    'silu': tf.keras.activations.swish,
    'swish': tf.keras.activations.swish,
    'tanh': tf.keras.activations.tanh,
}







def   a_						(					lowerCamelCase       ):
				if activation_string in ACTaFN:
								return ACTaFN[activation_string]
				else:
								raise KeyError(f'''function {activation_string} not found in ACT2FN mapping {list(ACTaFN.keys()       )}'''       )




"""simple docstring"""






from typing import TYPE_CHECKING

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


lowerCAmelCase__  :  str						     =	{
    'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'],
    'feature_extraction_mctct': ['MCTCTFeatureExtractor'],
    'processing_mctct': ['MCTCTProcessor'],
}


try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__  :  Any						     =	[
						    'MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'MCTCTForCTC',
						    'MCTCTModel',
						    'MCTCTPreTrainedModel',
						]


if TYPE_CHECKING:
						from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
						from .feature_extraction_mctct import MCTCTFeatureExtractor
						from .processing_mctct import MCTCTProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
						import sys

						lowerCAmelCase__  :  Any						     =	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



