Open
Description
qml.cond
can be used with the typical Catalyst conditional:
def true_fn():
qml.RY(0.7, wires=0)
qml.cond(x < 0.9, true_fn)()
But what doesn't work is the common PennyLane usage pattern for conditioning a single gate:
qml.cond(pred, qml.RY)(0.7, wires=0)
-> if true_fn.__code__.co_argcount != 0:
raise TypeError("Conditional 'True' function is not allowed to have any arguments")
AttributeError: type object 'PauliX' has no attribute '__code__'
The reason is that branch functions are not allowed to have arguments in Catalyst, although in this case there is also the check itself that fails.
In addition, the argument type would likely be restricted to JAX-compatible types, even if we did allow arguments.
The issue is somewhat related to similar bugs with seen with functionals like adjoint
and ctrl
in the PennyLane interface not working with all argument types that PL users might use.