Hello,
I am finding it a little difficult to find the gradient of my simple circuit using parameter shift rule.
@qml.qnode(dev_gaussian)
def experiment(r, a, phi, rot):
qml.Squeezing(r, 0, wires = 0)
qml.Displacement(a, phi, wires = 0)
qml.Rotation(rot, wires = 0)
return qml.expval(qml.X(0))
It is a basic squeezed coherent state with a rotation gate applied.
I find that when I try to find the gradient with respect to the rotation gate, the results by parameter shift rule doesn’t match that by finite differences.
Can you explain why this behaviour?
Parameter shift rule used as described in documentation:
plus = experiment(r,a,phi,rot + np.pi / 2)
minus = experiment(r,a,phi,rot - np.pi / 2)
grad = (0.5 * (plus - minus))