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

Hi @kannan_v — I think part of the confusion is that the parameter shift rules for CV are a little bit different than for standard qubit circuits. In particular they only apply to the expectation values of polynomials of the quadratures and have specific rules for specific gates. Please have a look at Sec. IV of Evaluating analytic gradients on quantum hardware where you can learn more about this.

Cheers,

Nicolas

Thank you for the response @Nicolas_Quesada!

I think since I’m trying to find the derivative of just a rotation gate, the parameter shift rule should be correct indeed. I’m not able to figure why it could still be wrong.

Regards,

Kannan

Hi @kannan_v — Understood. The second caveat is that the parameter shift rule serve only to calculate gradients of polynomials of of the quadratures. Your function is calculating the probabilities. The gradient of the probabilitites of Gaussian states is a much more complicated question. We have some theoretical work in that direction. If what you need are gradients you can always resort to finite differences.

Hope this helps

Hi @Nicolas_Quesada. That was exactly my confusion.

What I need is the gradient of the probability of the gaussian state. I was trying to see if I can find the gradient without having to go to finite differences since it is only an approximation.

I will look into the paper that you shared to see if that can help. Thank you very much

Kannan