



"""simple docstring"""







import math

import tensorflow as tf
from packaging import version

def       _lowerCamelCase				(							UpperCAmelCase_ :       Union[str, Any]     )	-> Optional[int]:






	"""simple docstring"""





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

	return x * cdf

def       _lowerCamelCase				(							UpperCAmelCase_ :       str     )	-> List[str]:






	"""simple docstring"""





	A__											=					tf.convert_to_tensor(UpperCAmelCase_     )
	A__											=					tf.cast(math.pi,	x.dtype     )
	A__											=					tf.cast(0.04_4715,	x.dtype     )
	A__											=					0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi     ) * (x + coeff * tf.pow(UpperCAmelCase_,	3     ))     ))

	return x * cdf

def       _lowerCamelCase				(							UpperCAmelCase_ :       List[Any]     )	-> int:






	"""simple docstring"""





	A__											=					tf.convert_to_tensor(UpperCAmelCase_     )

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

def       _lowerCamelCase				(							UpperCAmelCase_ :       int     )	-> Any:






	"""simple docstring"""





	A__											=					tf.convert_to_tensor(UpperCAmelCase_     )
	A__											=					tf.cast(0.04_4715,	x.dtype     )
	A__											=					tf.cast(0.79_7884_5608,	x.dtype     )

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

def       _lowerCamelCase				(							UpperCAmelCase_ :       List[str]     )	-> Any:






	"""simple docstring"""





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

def       _lowerCamelCase				(							UpperCAmelCase_ :       Tuple     )	-> Dict:






	"""simple docstring"""





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

def       _lowerCamelCase				(							UpperCAmelCase_ :       List[str],	UpperCAmelCase_ :       Tuple=-1     )	-> Any:






	"""simple docstring"""





	A__							,							A__											=					tf.split(UpperCAmelCase_,	2,	axis=UpperCAmelCase_     )
	return a * tf.math.sigmoid(UpperCAmelCase_     )


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

			def       _lowerCamelCase				(							UpperCAmelCase_ :       List[Any]     )	-> Tuple:






				"""simple docstring"""





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

			UpperCamelCase     =							tf.keras.activations.gelu




			UpperCamelCase     =							approximate_gelu_wrap
else:
			UpperCamelCase     =							_gelu
			UpperCamelCase     =							_gelu_new


UpperCamelCase     =							{
    """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				(							UpperCAmelCase_ :       Optional[int]     )	-> Optional[int]:






	"""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()     )}"""     )









"""simple docstring"""







import warnings

from ...utils import logging
from .image_processing_deit import DeiTImageProcessor


UpperCamelCase     =							logging.get_logger(__name__)






class       UpperCamelCase__			(   _lowerCAmelCase      ):

			"""simple docstring"""


			def __init__(      self						,	*SCREAMING_SNAKE_CASE__						,	**SCREAMING_SNAKE_CASE__		)      ->	None:
				warnings.warn(
				    "The class DeiTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
				    " use DeiTImageProcessor instead."						,	SCREAMING_SNAKE_CASE__						,	)
				super().__init__(*SCREAMING_SNAKE_CASE__						,	**SCREAMING_SNAKE_CASE__		)




