Converting a qiskit code to pennylane

Hi everyone, I want to convert a Qiskit code to pennylane to test the execution timing in pennylane. Since, it is using a lot of APIs of qiskit, not sure how should I start?

Hey @Manu_Chaudhary,

Great question! We have a special function just for this :star_struck:

Essentially, you wrap your qiskit circuit in qml.from_qiskit, and that’s it!

import pennylane as qml
import qiskit

qc = qiskit.QuantumCircuit(2)
qc.rz(0.543, [0])
qc.cx(0, 1)
my_circuit = qml.from_qiskit(qc)

dev = qml.device("default.qubit")

@qml.qnode(dev)
def circuit(x):
    qml.RX(x, wires=1)
    my_circuit(wires=(1, 0))
    return qml.expval(qml.PauliZ(0))

print(qml.draw(circuit)(0.1))
1: ──RX(0.10)──RZ(0.54)─╭●─┤     
0: ─────────────────────╰X─┤  <Z>

Let me know if this helps!