Closed glassnotes closed 9 months ago
FYI: the following workaround should work
from functools import partial
def subroutine(*, wires):
for wire in wires:
qml.PauliX(wire)
dev = qml.device("lightning.qubit", wires=3)
@qjit(autograph=True)
@qml.qnode(dev)
def test_function():
adjoint(partial(subroutine, wires=dev.wires))()
return qml.probs()
test_function()
Issue description
Expected behavior: A list of wires can be passed to a subroutine, and the subroutine executed both in its "regular" form as well as
adjoint
whenqjit
ting.Actual behavior: Errors are thrown in the
adjoint
call.Reproduces how often: (What percentage of the time does it reproduce?) Always
System information: (post the output of
import pennylane as qml; qml.about()
)I am on this branch/commit but was experiencing this previously on the main branch as well.
Source code and tracebacks
This version works:
However, if we instead do:
we obtain the following traceback:
Additionally, if we pass the wires as a
jnp.array
, a separate error occurs in the adjoint call:Additional information
Any additional information, configuration or data that might be necessary to reproduce the issue.