In this work https://journals.aps.org/pra/abstract/10.1103/PhysRevA.99.032331 it was shown that parameter shift rules can be used to compute gradients in CV quantum circuits that have a logarithmic number of non-Gaussian gates. Are there parameter shift rules for quantum circuits with arbitrary numbers of non-Gaussian gates? And does pennylane provide them?
Hi @Amanuel ,
The general answer is “yes” but in practice there may be some caveats (edit: this is not generally true for non-Gaussian gates). For example if you add too many gates you’ll run out of memory on your computer.
You can see the supported CV gates here.
The compatibility with other parts of PennyLane may also be patchy. Parameter shift rules are indeed defined for these operations, but other newer features may not be compatible. I would encourage you to start with a small example and see if it fits your needs.
Let us know if this works for you or if you run into any issues along the way!
Thank you for the reply @CatalinaAlbornoz this is good to know! Do you know if there is there a paper that outlines how parameter shift rules are defined for these non-Gaussian gates? Or is the original paper I linked what the PennyLane code is based on?
Hi @Amanuel ,
Actually in answering your question I realized that some non-Gaussian gates don’t have gradient recipes. I’m not sure if this is the case for all of them but if you go to the docs of the different CV gates listed here you’ll see that some (such as Beamsplitter) define the gradient recipe in the docs, but others (like Kerr) say that there’s no recipe hence finite-differences are used instead when running on hardware for example.
Thanks again for the follow-up question and I’m sorry for the mistake before.
Thanks @CatalinaAlbornoz this is incredibly helpful!
Hi @CatalinaAlbornoz I had a follow up question on this. Do these parameter shift rules work when there is loss in the quantum circuit? The original paper which proposed them does not seem to discuss this and neither do the docs from what I can find.