Catalyst does not support QJIT-compiling a parameterized circuit with qml.FlipSign
#1265
Labels
bug
Something isn't working
qml.FlipSign
#1265
We discovered this issue when attempting to QJIT-compile a circuit implementing Grover's algorithm.
Consider the following PennyLane program that applies the qml.FlipSign operator:
As expected, the circuit flips the sign of the$|00\rangle$ basis state:
>>> print(state) [-1.-0.j 0.+0.j 0.+0.j 0.+0.j]
When we attempt to QJIT-compile and execute this circuit, we get an error:
The error occurred in the FlipSign.compute_decomposition() method:
The problem is in statements like
if arr_bin[-1] == 0
, where in the jitted case,arr_bin
is a traced JAX array that is being used in Python control flow, which is not allowed.Compiling the circuit with AutoGraph,
@qjit(autograph=True)
, gives the same error, because AutoGraph is disabled by default for any module in PennyLane. To try to get around this issue, we followed the Adding modules for Autograph conversion docs and tried the following, which results in a different error:The appropriate changes to Catalyst and/or PennyLane should be made to add support for the
qml.FlipSign
operator in QJIT-compiled circuits, where the basis-state input toqml.FlipSign
is an input argument to the parameterized circuit.The text was updated successfully, but these errors were encountered: