Hello,
I have a Gaussian QNode collection experiment()
returning the mean and variance of a displaced squeezed state with an encoded phase. The parameters of the squeezing and displacement gates are in probe_state_params
Then the probs()
function takes the mean and variance returned by the QNode
mu_x, sigma_x = experiment(probe_state_params, encoded_phase)
and returns the gaussian probability distribution created with the mean and variance.
Now I need to find the derivative of the probability distribution w.r.t the encoded_phase. So I’m using parameter shift rule for that.
shift = np.pi / 2
plus = probs(probe_state_params, encoded_phase + shift)
minus = probs(probe_state_params, encoded_phase - shift)
dp = (0.5 * (plus - minus))
However, when I’m pretty sure the derivative I have computed is incorrect. Am I using the parameter shift rule correctly?
All the probe_state_params
and encoded_phase
have an inital value assigned.
Thank you in advance
- Kannan