10.2 Quantum neural networks in PennyLane
We are now ready to implement and train our first quantum neural network with PennyLane. The PennyLane framework is great for many applications, but it shines the most when it comes to the implementation of quantum neural network models. This is all due to its flexibility and good integration with classical machine learning frameworks. We, in particular, are going to be using PennyLane in conjunction with TensorFlow to train a QNN-based binary classifier. All that effort that we invested in Chapter 8, What is Quantum Machine Learning?, is finally going to pay off!
Important note
Remember that we are using version 2.9.1 of the TensorFlow package and version 0.26 of PennyLane.
Let’s begin by importing PennyLane, NumPy, and TensorFlow and setting some seeds for these packages, just to make sure that our results are reproducible. We can achieve this with the following piece of code:
import pennylane as qml import numpy as np import...