



import math

import tensorflow as tf
from packaging import version






def  lowerCamelCase_	(      lowerCAmelCase__	:	Optional[int]				)       ->							Any:

							'''simple docstring'''






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

							return x * cdf






def  lowerCamelCase_	(      lowerCAmelCase__	:	List[str]				)       ->							List[Any]:

							'''simple docstring'''






							A      						=    tf.convert_to_tensor(lowerCAmelCase__				)
							A      						=    tf.cast(math.pi			,	x.dtype				)
							A      						=    tf.cast(0.044715			,	x.dtype				)
							A      						=    0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi				) * (x + coeff * tf.pow(lowerCAmelCase__			,	3				))				))

							return x * cdf






def  lowerCamelCase_	(      lowerCAmelCase__	:	Optional[Any]				)       ->							Optional[int]:

							'''simple docstring'''






							A      						=    tf.convert_to_tensor(lowerCAmelCase__				)

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






def  lowerCamelCase_	(      lowerCAmelCase__	:	Union[str, Any]				)       ->							Optional[int]:

							'''simple docstring'''






							A      						=    tf.convert_to_tensor(lowerCAmelCase__				)
							A      						=    tf.cast(0.044715			,	x.dtype				)
							A      						=    tf.cast(0.7978845608			,	x.dtype				)

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






def  lowerCamelCase_	(      lowerCAmelCase__	:	Optional[Any]				)       ->							List[str]:

							'''simple docstring'''






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






def  lowerCamelCase_	(      lowerCAmelCase__	:	Optional[Any]				)       ->							Any:

							'''simple docstring'''






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






def  lowerCamelCase_	(      lowerCAmelCase__	:	List[Any]			,	lowerCAmelCase__	:	Tuple=-1				)       ->							List[str]:

							'''simple docstring'''






							A						,   A      						=    tf.split(lowerCAmelCase__			,	2			,	axis=lowerCAmelCase__				)
							return a * tf.math.sigmoid(lowerCAmelCase__				)


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






				def  lowerCamelCase_	(      lowerCAmelCase__	:	str				)       ->							Optional[Any]:

											'''simple docstring'''






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

				__snake_case     :List[str]			       =tf.keras.activations.gelu



				__snake_case     :Optional[Any]			       =approximate_gelu_wrap
else:
				__snake_case     :Any			       =_gelu
				__snake_case     :str			       =_gelu_new


__snake_case     :List[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  lowerCamelCase_	(      lowerCAmelCase__	:	List[Any]				)       ->							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 __future__ import annotations

import numpy as np
def 							UpperCamelCase_(					_A :list[float]	)->		Optional[Any]:
			return np.maximum(0					,  _A	)


if __name__ == "__main__":
						print(np.array(relu([-1, 0, 5])))  # --> [0, 0, 5]


