



import math

import tensorflow as tf
from packaging import version






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Tuple	):





			"""simple docstring"""




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

			return x * cdf






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Tuple	):





			"""simple docstring"""




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

			return x * cdf






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Union[str, Any]	):





			"""simple docstring"""




			UpperCamelCase         =					tf.convert_to_tensor(SCREAMING_SNAKE_CASE_	)

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






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Optional[Any]	):





			"""simple docstring"""




			UpperCamelCase         =					tf.convert_to_tensor(SCREAMING_SNAKE_CASE_	)
			UpperCamelCase         =					tf.cast(0.04_4715       ,  x.dtype	)
			UpperCamelCase         =					tf.cast(0.79_7884_5608       ,  x.dtype	)

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






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		int	):





			"""simple docstring"""




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






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		List[Any]	):





			"""simple docstring"""




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






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Union[str, Any]       ,  SCREAMING_SNAKE_CASE_   :		Optional[Any]=-1	):





			"""simple docstring"""




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


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






			def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Any	):





						"""simple docstring"""




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

			__snake_case            =   tf.keras.activations.gelu
			__snake_case            =   approximate_gelu_wrap
else:
			__snake_case            =   _gelu
			__snake_case            =   _gelu_new


__snake_case            =   {
    "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 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Dict	):





			"""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 qiskit






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		int = 2	):





			"""simple docstring"""




			UpperCamelCase         =					qubits

			# Using Aer's simulator
			UpperCamelCase         =					qiskit.Aer.get_backend("""aer_simulator"""	)

			# Creating a Quantum Circuit acting on the q register
			UpperCamelCase         =					qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_	)

			# Adding a H gate on qubit 0 (now q0 in superposition)
			circuit.h(0	)

			for i in range(1       ,  SCREAMING_SNAKE_CASE_	):
						# Adding CX (CNOT) gate
						circuit.cx(i - 1       ,  SCREAMING_SNAKE_CASE_	)

			# Mapping the quantum measurement to the classical bits
			circuit.measure(list(range(SCREAMING_SNAKE_CASE_	)	)       ,  list(range(SCREAMING_SNAKE_CASE_	)	)	)

			# Now measuring any one qubit would affect other qubits to collapse
			# their super position and have same state as the measured one.

			# Executing the circuit on the simulator
			UpperCamelCase         =					qiskit.execute(SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_       ,  shots=1_000	)

			return job.result().get_counts(SCREAMING_SNAKE_CASE_	)


if __name__ == "__main__":
			print(F'''Total count for various states are: {quantum_entanglement(3)}''')




