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?
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
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 !