



import math

import tensorflow as tf
from packaging import version





def 					__snake_case     (      _UpperCAmelCase    ):
    __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 					__snake_case     (      _UpperCAmelCase    ):
    __a							=    tf.convert_to_tensor(_UpperCAmelCase    )
    __a							=    tf.cast(math.pi       ,			x.dtype    )
    __a							=    tf.cast(0.04_47_15       ,			x.dtype    )
    __a							=    0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi    ) * (x + coeff * tf.pow(_UpperCAmelCase       ,			3    ))    ))

    return x * cdf





def 					__snake_case     (      _UpperCAmelCase    ):
    __a							=    tf.convert_to_tensor(_UpperCAmelCase    )

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





def 					__snake_case     (      _UpperCAmelCase    ):
    __a							=    tf.convert_to_tensor(_UpperCAmelCase    )
    __a							=    tf.cast(0.04_47_15       ,			x.dtype    )
    __a							=    tf.cast(0.79_78_84_56_08       ,			x.dtype    )

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





def 					__snake_case     (      _UpperCAmelCase    ):
    __a							=    tf.convert_to_tensor(_UpperCAmelCase    )
    __a							=    tf.cast(1.7_02       ,			x.dtype    )
    return x * tf.math.sigmoid(coeff * x    )





def 					__snake_case     (      _UpperCAmelCase    ):
    return tf.clip_by_value(_gelu(_UpperCAmelCase    )       ,			-10       ,			10    )





def 					__snake_case     (      _UpperCAmelCase       ,			_UpperCAmelCase=-1    ):
    __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 					__snake_case     (      _UpperCAmelCase    ):
     return tf.keras.activations.gelu(_UpperCAmelCase       ,			approximate=_UpperCAmelCase    )

 __snake_case						:Optional[int]						=					tf.keras.activations.gelu
 __snake_case						:List[str]						=					approximate_gelu_wrap
else:
 __snake_case						:str						=					_gelu
 __snake_case						:Optional[int]						=					_gelu_new


__snake_case						:List[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 					__snake_case     (      _UpperCAmelCase    ):
    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       ,			_UpperCAmelCase    ):
    return base * power(_UpperCAmelCase       ,			(exponent - 1)    ) if exponent else 1


if __name__ == "__main__":
 print('''Raise base to the power of exponent using recursion...''')
 __snake_case						:List[Any]						=					int(input('''Enter the base: ''').strip())
 __snake_case						:Dict						=					int(input('''Enter the exponent: ''').strip())
 __snake_case						:int						=					power(base, abs(exponent))
 if exponent < 0:  # power() does not properly deal w/ negative exponents
  __snake_case						:Optional[Any]						=					1 / result
 print(f'{base} to the power of {exponent} is {result}')





