qml.load¶
-
load
(quantum_circuit_object, format, **load_kwargs)[source]¶ Load external quantum assembly and quantum circuits from supported frameworks into PennyLane templates.
Warning
qml.load
is deprecated. Instead, please use the functions outlined in the Importing Circuits quickstart guide, such asqml.from_qiskit
.Note
For more details on which formats are supported please consult the corresponding plugin documentation: https://pennylane.ai/plugins.html
Example:
>>> qc = qiskit.QuantumCircuit(2) >>> qc.rz(0.543, [0]) >>> qc.cx(0, 1) >>> my_circuit = qml.load(qc, format='qiskit')
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.Z(0))
- Parameters
quantum_circuit_object – the quantum circuit that will be converted to a PennyLane template
format (str) – the format of the quantum circuit object to convert from
**load_kwargs – keyword arguments to pass when converting the quantum circuit using the plugin. See below for details about supported keyword arguments.
- Keyword Arguments
measurements (list[MeasurementProcess]) – the list of PennyLane measurements that overrides the terminal measurements that may be present in the imput circuit. Currently, only supported for Qiskit’s QuantumCircuit.
- Returns
the PennyLane template created from the quantum circuit object
- Return type
function