Hello,
I want to know how QNode is learning and calculating gradient in the below link https://pennylane.ai/qml/demos/tutorial_qnn_module_tf.html
Is this QNode learning calculating gradient on the principle of variational classifier?
Hey @mustafaec,
The QNode
object is transformed to a Keras layer by using qml.qnn.KerasLayer(qnode, weight_shapes, output_dim=n_qubits)
it creates a TensorFlow
compatible tape and then the model is trained with the Keras SGD optimizer. The QNode
comes with a specific diff_method=best
which will be used to evaluate the gradient in the background for the given device. You can find more information about QNode
in the documentation here.
Feel free to ask more questions if needed!