My code works with my other custom optimizers + other pennylane optimizers like SPSA, but when I use QNSPSA I get the following error:
RuntimeError: Lightning does not currently support out-of-order indices for probabilities
When I use default.qubit it works. Is QNSPSA not supposed to work with lightning or is this a bug?
Hello @Lucas_Tecot,
It looks like this demo uses QNSPSA with lightning.qubit. I hope this helps. Quantum natural SPSA optimizer
This demo re-implements QNSPSA from scratch, I’m talking about the one implemented by Pennylane
Hello @Lucas_Tecot
The error you’re getting from lightning.qubit
can be pinned down here: pennylane_lightning.lightning_qubit — PennyLane-Lightning 0.31.0 documentation It seems that lightning.qubit
requires the wires to be labelled in increasing order in order to return probabilities. Without knowing more about your source code, it’s a little bit unclear to me if this is an issue with the wires or an optimizer issue.
Let us know if this is helpful; if not, then it’s most likely a clash between the optimizer and the device, and we’ll need to dig deeper to fix it !
Cheers,
Alvaro
1 Like
I think it’s unlikely it’s an issue with lightning.qubit, because when I use my custom-impemented QNSPSA optimizer on the same code it runs just fine.
Hey @Lucas_Tecot,
Are you able to share your code? It will help us figure out what the issue is