qml.load

load(quantum_circuit_object, format)[source]

Load external quantum assembly and quantum circuits from supported frameworks into PennyLane templates.

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.PauliZ(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

Returns

the PennyLane template created from the quantum circuit object

Return type

function

Contents

Using PennyLane

Development

API

Internals