You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.The text was updated successfully, but these errors were encountered: