
"""simple docstring"""



import math

import tensorflow as tf
from packaging import version


def  _UpperCamelCase	(						_A      )    ->  Optional[int]:





    """simple docstring"""

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

    return x * cdf


def  _UpperCamelCase	(						_A      )    ->  Union[str, Any]:





    """simple docstring"""

    _UpperCAmelCase          =   tf.convert_to_tensor(__UpperCamelCase      )
    _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(__UpperCamelCase					,      3      ))      ))

    return x * cdf


def  _UpperCamelCase	(						_A      )    ->  str:





    """simple docstring"""

    _UpperCAmelCase          =   tf.convert_to_tensor(__UpperCamelCase      )

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


def  _UpperCamelCase	(						_A      )    ->  List[Any]:





    """simple docstring"""

    _UpperCAmelCase          =   tf.convert_to_tensor(__UpperCamelCase      )
    _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  _UpperCamelCase	(						_A      )    ->  List[str]:





    """simple docstring"""

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


def  _UpperCamelCase	(						_A      )    ->  List[Any]:





    """simple docstring"""

    return tf.clip_by_value(_gelu(__UpperCamelCase      )					,      -1_0					,      1_0      )


def  _UpperCamelCase	(						_A					,      _A=-1      )    ->  Any:





    """simple docstring"""

    _UpperCAmelCase    ,_UpperCAmelCase          =   tf.split(__UpperCamelCase					,      2					,      axis=__UpperCamelCase      )
    return a * tf.math.sigmoid(__UpperCamelCase      )


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


 def  _UpperCamelCase	(						_A      )    ->  Union[str, Any]:





     """simple docstring"""

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

 a					:	Optional[Any]							=		tf.keras.activations.gelu







 a					:	List[str]							=		approximate_gelu_wrap
else:
 a					:	str							=		_gelu
 a					:	List[str]							=		_gelu_new


a					:	str							=		{
    '''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  _UpperCamelCase	(						_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()      )}"""      )

"""simple docstring"""



from __future__ import annotations


def  _UpperCamelCase	(						_A      )    ->  None:





    """simple docstring"""

    create_state_space_tree(_A					,      []					,      0					,      [0 for i in range(len(_A      )      )]      )


def  _UpperCamelCase	(						_A					,      _A					,      _A					,      _A					,      )    ->  None:





    """simple docstring"""

    if index == len(_A      ):
        print(_A      )
        return

    for i in range(len(_A      )      ):
        if not index_used[i]:
            current_sequence.append(sequence[i]      )
            _UpperCAmelCase          =   True
            create_state_space_tree(_A					,      _A					,      index + 1					,      _A      )
            current_sequence.pop()
            _UpperCAmelCase          =   False
a					:	list[int | str]							=		[3, 1, 2, 4]
generate_all_permutations(sequence)

a					:	list[int | str]							=		["A", "B", "C"]







generate_all_permutations(sequence_a)