The PennyLane-Qiskit plugin integrates the Qiskit quantum computing framework with PennyLane’s quantum machine learning capabilities.
PennyLane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.
Qiskit is an open-source framework for quantum computing.
Once the PennyLane-Qiskit plugin is installed, the the Qiskit devices can be accessed straightaway in PennyLane, without the need to import new packages.
Currently, there are three different devices available:
For example, the
'qiskit.aer' device with two wires is called like this:
import pennylane as qml dev = qml.device('qiskit.aer', wires=2)
Qiskit devices have different backends, which define which actual simulator or hardware is used by the device. Different simulator backends are optimized for different types of circuits. A backend can be defined as follows:
dev = qml.device('qiskit.aer', wires=2, backend='unitary_simulator')
PennyLane chooses the
qasm_simulator as the default backend if no backend is specified.
For more details on the
qasm_simulator, including available backend options, see
Qiskit Qasm Simulator documentation.
To see the PennyLane-Qiskit plugin in action, you can use any of the qubit based demos
from the PennyLane documentation, for example
the tutorial on qubit rotation,
and simply replace
'default.qubit' with any of the available Qiskit devices, such as
dev = qml.device('qiskit.aer', wires=XXX)
You can also try to run tutorials, such as the qubit rotation tutorial, on actual quantum hardware by
To filter tutorials that explicitly use a qiskit device, use the “Qiskit” filter on the right panel of the demos.