Error with Parameter-Shift Gradient Computation in PennyLane when Integrating with PyTorch & PyTorch Lightning

Hi @Lazarus ,

I’m sorry to hear you’ve been struggling and trying out a bunch of things.

I think the issue here is with TorchLayer.

A few months ago someone had a similar problem so I created this example where I create a class that inherits from nn.Module, instead of using TorchLayer. What I’d suggest is that you try doing something similar where you apply the quantum circuit to each individual element of the batch.

Let me know if this works for you!

1 Like