
import math

import tensorflow as tf
from packaging import version






def 						__magic_name__			(   __a      :	List[str]						):



					'''simple docstring'''




					UpperCamelCase__				=    tf.convert_to_tensor(__a						)
					UpperCamelCase__				=    0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0						)	,		x.dtype						)						))

					return x * cdf






def 						__magic_name__			(   __a      :	List[Any]						):



					'''simple docstring'''




					UpperCamelCase__				=    tf.convert_to_tensor(__a						)
					UpperCamelCase__				=    tf.cast(math.pi	,		x.dtype						)
					UpperCamelCase__				=    tf.cast(0.044_715	,		x.dtype						)
					UpperCamelCase__				=    0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi						) * (x + coeff * tf.pow(__a	,		3						))						))

					return x * cdf






def 						__magic_name__			(   __a      :	Union[str, Any]						):



					'''simple docstring'''




					UpperCamelCase__				=    tf.convert_to_tensor(__a						)

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






def 						__magic_name__			(   __a      :	Tuple						):



					'''simple docstring'''




					UpperCamelCase__				=    tf.convert_to_tensor(__a						)
					UpperCamelCase__				=    tf.cast(0.044_715	,		x.dtype						)
					UpperCamelCase__				=    tf.cast(0.7_978_845_608	,		x.dtype						)

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






def 						__magic_name__			(   __a      :	Tuple						):



					'''simple docstring'''




					UpperCamelCase__				=    tf.convert_to_tensor(__a						)
					UpperCamelCase__				=    tf.cast(1.702	,		x.dtype						)
					return x * tf.math.sigmoid(coeff * x						)






def 						__magic_name__			(   __a      :	List[Any]						):



					'''simple docstring'''




					return tf.clip_by_value(_gelu(__a						)	,		-10	,		10						)






def 						__magic_name__			(   __a      :	List[str]	,		__a      :	Optional[Any]=-1						):



					'''simple docstring'''




					UpperCamelCase__		,	UpperCamelCase__				=    tf.split(__a	,		2	,		axis=__a						)
					return a * tf.math.sigmoid(__a						)


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






				def 						__magic_name__			(   __a      :	Tuple						):



									'''simple docstring'''




									return tf.keras.activations.gelu(__a	,		approximate=__a						)

				lowerCamelCase_						     =					tf.keras.activations.gelu




				lowerCamelCase_						     =					approximate_gelu_wrap
else:
				lowerCamelCase_						     =					_gelu
				lowerCamelCase_						     =					_gelu_new


lowerCamelCase_						     =					{
    '''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 						__magic_name__			(   __a      :	str						):



					'''simple docstring'''




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







from typing import TYPE_CHECKING

from ...utils import _LazyModule


lowerCamelCase_						     =					{'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']}


if TYPE_CHECKING:
    from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
    import sys

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





