






import math

import tensorflow as tf
from packaging import version







def      snake_case		(							UpperCAmelCase	:       Any   ):

				'''simple docstring'''





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

				return x * cdf







def      snake_case		(							UpperCAmelCase	:       str   ):

				'''simple docstring'''





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

				return x * cdf







def      snake_case		(							UpperCAmelCase	:       Optional[int]   ):

				'''simple docstring'''





				A	 =      tf.convert_to_tensor(A_   )

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







def      snake_case		(							UpperCAmelCase	:       List[Any]   ):

				'''simple docstring'''





				A	 =      tf.convert_to_tensor(A_   )
				A	 =      tf.cast(0.044_715,						x.dtype   )
				A	 =      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      snake_case		(							UpperCAmelCase	:       Any   ):

				'''simple docstring'''





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







def      snake_case		(							UpperCAmelCase	:       Optional[int]   ):

				'''simple docstring'''





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







def      snake_case		(							UpperCAmelCase	:       List[Any],						UpperCAmelCase	:       Any=-1   ):

				'''simple docstring'''





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


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







					def      snake_case		(							UpperCAmelCase	:       Dict   ):

									'''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      snake_case		(							UpperCAmelCase	:       List[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()   )}'   )













def      snake_case		(							UpperCAmelCase	:       int   ):
				A	 =      0
				while num > 0:
								digit_sum += num % 10
								num //= 10
				return digit_sum







def      snake_case		(							UpperCAmelCase	:       int = 1_00   ):
				A	 =      1
				A	 =      2

				for i in range(2,						max_n + 1   ):
								A	 =      pre_numerator
								A	 =      2 * i // 3 if i % 3 == 0 else 1
								A	 =      cur_numerator
								A	 =      e_cont * pre_numerator + temp

				return sum_digits(UpperCAmelCase   )


if __name__ == "__main__":
					print(f'''{solution() = }''')





