


'''simple docstring'''

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def __snake_case (				UpperCAmelCase_						:						float = np.pi / 2 ,    UpperCAmelCase_						:						float = np.pi / 2 ,    UpperCAmelCase_						:						float = np.pi / 2		):
 lowerCamelCase_								=  QuantumRegister(3 ,    "qr"		)  # Define the number of quantum bits
 lowerCamelCase_								=  ClassicalRegister(1 ,    "cr"		)  # Define the number of classical bits

 lowerCamelCase_								=  QuantumCircuit(UpperCAmelCase_ ,    UpperCAmelCase_		)  # Define the quantum circuit.

 # Build the circuit
 quantum_circuit.u(UpperCAmelCase_ ,    UpperCAmelCase_ ,    UpperCAmelCase_ ,    0		)  # Quantum State to teleport
 quantum_circuit.h(1		)  # add hadamard gate
 quantum_circuit.cx(
     1 ,    2		)  # add control gate with qubit 1 as control and 2 as target.
 quantum_circuit.cx(0 ,    1		)
 quantum_circuit.h(0		)
 quantum_circuit.cz(0 ,    2		)  # add control z gate.
 quantum_circuit.cx(1 ,    2		)

 quantum_circuit.measure([2] ,    [0]		)  # measure the qubit.

 # Simulate the circuit using qasm simulator
 lowerCamelCase_								=  Aer.get_backend("aer_simulator"		)
 lowerCamelCase_								=  execute(UpperCAmelCase_ ,    UpperCAmelCase_ ,    shots=1000		)

 return job.result().get_counts(UpperCAmelCase_		)


if __name__ == "__main__":
     print(
         """Total count for teleported state is: """
         f'''{quantum_teleportation(np.pi/2, np.pi/2, np.pi/2)}'''
     )







'''simple docstring'''

import unittest

import numpy as np

from transformers import is_tf_available
from transformers.testing_utils import require_tf


if is_tf_available():
     import tensorflow as tf

     from transformers.activations_tf import get_tf_activation





@require_tf
class 					snake_case   (   unittest.TestCase      ):





  """simple docstring"""




  def   snake_case		(   self					):







   """simple docstring"""
   lowerCamelCase_								=  tf.constant([-100, -1.0, -0.1, 0, 0.1, 1.0, 100.0]					)
   lowerCamelCase_								=  get_tf_activation("gelu"					)
   lowerCamelCase_								=  get_tf_activation("gelu_10"					)

   lowerCamelCase_								=  gelu(UpperCamelCase					)
   lowerCamelCase_								=  geluaa(UpperCamelCase					)

   lowerCamelCase_								=  tf.where(y_gelu_aa < 10.0      ,  1.0      ,  0.0					)

   self.assertEqual(tf.math.reduce_max(UpperCamelCase					).numpy().item()      ,  10.0					)
   self.assertTrue(np.allclose(y_gelu * clipped_mask      ,  y_gelu_aa * clipped_mask					)					)







  def   snake_case		(   self					):







   """simple docstring"""
   get_tf_activation("gelu"					)
   get_tf_activation("gelu_10"					)
   get_tf_activation("gelu_fast"					)
   get_tf_activation("gelu_new"					)
   get_tf_activation("glu"					)
   get_tf_activation("mish"					)
   get_tf_activation("quick_gelu"					)
   get_tf_activation("relu"					)
   get_tf_activation("sigmoid"					)
   get_tf_activation("silu"					)
   get_tf_activation("swish"					)
   get_tf_activation("tanh"					)
   with self.assertRaises(UpperCamelCase					):
    get_tf_activation("bogus"					)
   with self.assertRaises(UpperCamelCase					):
    get_tf_activation(UpperCamelCase					)



