






import qiskit




def       _SCREAMING_SNAKE_CASE (							__snake_case = 2 )				->						qiskit.result.counts.Counts:
       _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(__snake_case   ,      __snake_case )

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

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

       # Mapping the quantum measurement to the classical bits
       circuit.measure(list(range(__snake_case ) )   ,      list(range(__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(__snake_case   ,      __snake_case   ,      shots=1_0_0_0 )

       return job.result().get_counts(__snake_case )


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

"""simple docstring"""

import os
import time

import numpy as np
import onnxruntime as ort


SCREAMING_SNAKE_CASE_            =    '''1'''
SCREAMING_SNAKE_CASE_            =    '''0'''
SCREAMING_SNAKE_CASE_            =    '''1'''

SCREAMING_SNAKE_CASE_            =    ort.SessionOptions()
SCREAMING_SNAKE_CASE_            =    ort.GraphOptimizationLevel.ORT_DISABLE_ALL
print('''Create inference session...''')
SCREAMING_SNAKE_CASE_            =    ['''TensorrtExecutionProvider''', '''CUDAExecutionProvider''']
SCREAMING_SNAKE_CASE_            =    ort.InferenceSession('''model.onnx''', sess_options=sess_opt, providers=execution_provider)
SCREAMING_SNAKE_CASE_            =    ort.RunOptions()

SCREAMING_SNAKE_CASE_            =    128
SCREAMING_SNAKE_CASE_            =    1
SCREAMING_SNAKE_CASE_            =    np.ones((batch, sequence), dtype=np.intaa)
SCREAMING_SNAKE_CASE_            =    np.ones((batch, sequence), dtype=np.intaa)
SCREAMING_SNAKE_CASE_            =    np.ones((batch, sequence), dtype=np.intaa)

print('''Warm up phase...''')
sess.run(
    None,
    {
        sess.get_inputs()[0].name: input_ids,
        sess.get_inputs()[1].name: attention_mask,
        sess.get_inputs()[2].name: token_type_ids,
    },
    run_options=run_opt,
)

print('''Start inference...''')
SCREAMING_SNAKE_CASE_            =    time.time()
SCREAMING_SNAKE_CASE_            =    2000
SCREAMING_SNAKE_CASE_            =    {}
for iter in range(max_iters):
   SCREAMING_SNAKE_CASE_            =    sess.run(
       None,
       {
           sess.get_inputs()[0].name: input_ids,
           sess.get_inputs()[1].name: attention_mask,
           sess.get_inputs()[2].name: token_type_ids,
       },
       run_options=run_opt,
   )
print('''Average Inference Time = {:.3f} ms'''.format((time.time() - start_time) * 1000 / max_iters))



