





"""simple docstring"""





import math

import tensorflow as tf
from packaging import version


def 					a__    (    _SCREAMING_SNAKE_CASE			):




		"""simple docstring"""


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

		return x * cdf


def 					a__    (    _SCREAMING_SNAKE_CASE			):




		"""simple docstring"""


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

		return x * cdf


def 					a__    (    _SCREAMING_SNAKE_CASE			):




		"""simple docstring"""


		UpperCamelCase      =		tf.convert_to_tensor(__A			)

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


def 					a__    (    _SCREAMING_SNAKE_CASE			):




		"""simple docstring"""


		UpperCamelCase      =		tf.convert_to_tensor(__A			)
		UpperCamelCase      =		tf.cast(0.04_47_15     ,		x.dtype			)
		UpperCamelCase      =		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 					a__    (    _SCREAMING_SNAKE_CASE			):




		"""simple docstring"""


		UpperCamelCase      =		tf.convert_to_tensor(__A			)
		UpperCamelCase      =		tf.cast(1.7_02     ,		x.dtype			)
		return x * tf.math.sigmoid(coeff * x			)


def 					a__    (    _SCREAMING_SNAKE_CASE			):




		"""simple docstring"""


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


def 					a__    (    _SCREAMING_SNAKE_CASE     ,		_SCREAMING_SNAKE_CASE=-1			):




		"""simple docstring"""


		UpperCamelCase      , UpperCamelCase      =		tf.split(__A     ,		2     ,		axis=__A			)
		return a * tf.math.sigmoid(__A			)


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


						def 					a__    (    _SCREAMING_SNAKE_CASE			):




								"""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 					a__    (    _SCREAMING_SNAKE_CASE			):




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







import math
import random




def    lowerCAmelCase_ (     __A,  __A = False							)     ->				float:







      '''simple docstring'''


      if deriv:
            return value * (1 - value)
      return 1 / (1 + math.exp(-value							))


# Initial Value
UpperCamelCase__											=					0.0_2




def    lowerCAmelCase_ (     __A,  __A							)     ->				float:







      '''simple docstring'''


      UpperCAmelCase__								=  float(2 * (random.randint(1,  100							)) - 1							)

      for _ in range(__A							):
            # Forward propagation
            UpperCAmelCase__								=  sigmoid_function(INITIAL_VALUE * weight							)
            # How much did we miss?
            UpperCAmelCase__								=  (expected / 100) - layer_a
            # Error delta
            UpperCAmelCase__								=  layer_1_error * sigmoid_function(__A,  __A							)
            # Update weight
            weight += INITIAL_VALUE * layer_1_delta

      return layer_a * 100


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      UpperCamelCase__											=					int(input('Expected value: '))
      UpperCamelCase__											=					int(input('Number of propagations: '))
      print(forward_propagation(expected, number_propagations))



