Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Having some trouble when using shots #33

Open
stroblme opened this issue Oct 17, 2023 · 1 comment
Open

[BUG] Having some trouble when using shots #33

stroblme opened this issue Oct 17, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@stroblme
Copy link
Member

Describe the bug
The current implementation runs fully analytically which is motivated by faster simulation times and by the fact, that the effect of shots are not the focus of interest within this project (tbd.).
However, when trying to enable shots, Pennylane tries to artifically sample from the probabilities received from the quantum circuit output. Within a hybrid setup (with batches) this usually has the dimension of [B, N] where N=2^n and B being the batch size.
However, without batch_input decorator, the Pennylane sampling devices seems to not expect this additional batch dimension and therefore complains about B being not equal 2^n.
Adding the decorator however requires setting arbnum to the parameter index that contains the non-trainable weights, i.e. the input.
In a hybrid setup however, the input is just the output of the preceding classical module and therefore has a requires_grad flag, i.e. is trainable, which is why adding this decorator fails.

@stroblme stroblme added the bug Something isn't working label Oct 17, 2023
@stroblme
Copy link
Member Author

The current workaround is to iterate over the batch dimension within the forward method, execute the circuit multiple times and then combine the output. This works but is obviously a bottleneck as batches could be executed in parallel.
Furthermore this feels super hacky and, from what I know, is actually an issue with the Pennylane framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant