import pennylane as qml
dev = qml.device('default.qubit', wires=[0, 1, 2, 3, 4])
@qml.qnode(dev)
def circuit():
qml.RX(0.5, wires=[0])
qml.CZ(wires=[0, 4])
qml.RZ(0.2, wires=[1])
return qml.probs()
transpiled_circuit = qml.transforms.transpile(circuit, coupling_map=[(0, 2), (1, 2), (2, 3), (2, 4)])
compiled_circuit = qml.compile(
transpiled_circuit,
pipeline=[
qml.transforms.commute_controlled,
qml.transforms.merge_rotations,
qml.transforms.cancel_inverses,
],
basis_set=["CNOT", "RX", "RZ"],
)
print(qml.draw(compiled_circuit)())
qml_to_qasm_circuit = compiled_circuit.qtape.to_openqasm()
print(qml_to_qasm_circuit)
Hello pennylane team,
I am trying to generate a qasm file for a compiled quantum circuit. Printing the circuit actually gives me the desired outcome (see first print statement). However, when I try to convert the circuit into qasm format, it always returns the original, uncompiled circuit. Is there something obvious I am missing out?
Thanks in advance for your help!
James
Name: PennyLane Version: 0.36.0