Mutable option in devices


The structure of my circuit remains unchanged regardless of the input parameters. As a result, I intended to set mutable=False and take advantage of the mutable option from qml.Qnode. But doing so brings with it the following warning:

/usr/local/lib/python3.10/dist-packages/pennylane/workflow/ UserWarning: Received gradient_kwarg mutable, which is not included in the list of standard qnode gradient kwargs.

I tried to use version 0.16.0 found here. However, at that time, the “torch” interface was unavailable.

Since modeling my circuit is taking too much time, could someone perhaps point me in the direction of where I may find the mutable option?

Hey @Nabil_Anan_Orka, welcome to the forum! :sunglasses:

The mutable argument was removed in v0.20 and it won’t be making a comeback to PennyLane. Are you able to share your code with me so that I can try to replicate the error you’re getting?

Hi @isaacdevlugt!

Thank you for your quick response. There was no error because the code functioned properly. The mutable option, though, was something I was really looking forward to because the simulation is taking far longer than it should. Since mutable has been removed, is there an alternative to mutable that I can pursue?

For performance, you can look to a number of options:

Let me know if either of these help! If not, then sharing your code here would help me see if there’s something going on that can be ameliorated outside of using a new device / plugin :slight_smile: