Closed wcqc closed 3 months ago
This module draws most of its advantage in runtime speed by optimizing during __init__
. Therefore, creating circuits during the forward pass is not recommended with this package. You might rather want look towards PennyLane for such use-case.
How about reusing a predefined quantum circuit in init but feeding in different inputs in forward?
Yes, that is possible using named gates. Check out the docs: define a gate, e.g. RX(qubit=1, name="gate1")
, and pass custom values to it during the forward pass of your module circuit(gate1=torch.tensor(1.2))
. This should support batched inputs out-of-the-box.
Make sure to use the latest release of qandle
(pip install --upgrade qandle
), as I just fixed a bug caused by batching.
Hi,
Does this support dynamically structured and defined computation graphs? For example, constructing a quantum circuit on the fly in the forward pass of PyTorch?
Thanks for any clarification.