qml.from_qasm_file¶
-
from_qasm_file
(qasm_filename)[source]¶ Loads quantum circuits from a QASM file using the converter in the PennyLane-Qiskit plugin.
Example:
>>> my_circuit = qml.from_qasm("hadamard_circuit.qasm")
The
my_circuit
template can now be used within QNodes, as a two-wire quantum template.>>> @qml.qnode(dev) >>> def circuit(x): >>> qml.RX(x, wires=1) >>> my_circuit(wires=(1, 0)) >>> return qml.expval(qml.PauliZ(0))
- Parameters
qasm_filename (str) – path to a QASM file containing a valid quantum circuit
- Returns
the PennyLane template created based on the QASM file
- Return type
function
code/api/pennylane.from_qasm_file
Download Python script
Download Notebook
View on GitHub