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
# Changing the qnode in the above to the following gives the same behavior@qml.transforms.unitary_to_rot@qml.qnode(dev)defcircuit(x):
U=jnp.array([[1,0],[0,x]])
qml.QubitUnitary(U, wires=0)
returnqml.probs()
Note that with this method, the intermediate mlir does indeed show the decomposed rotation gates instead of unitary gates.
Note that specifying a "decomposition" manually does not break:
Workflows involving
QubitUnitary
cannot be differentiated because lightning does not support taking their gradients.As a workaround, we can try to decompose the
QubitUnitary
first. However, this also fails. We present two methods that both fail:(a) With
qml.QubitUnitary.compute_decomposition
(Note that this method is restrictive in the first place, as it only works on 2-by-2 and 4-by-4 matrices)
(b) With
qml.transforms.unitary_to_rot
Note that with this method, the intermediate mlir does indeed show the decomposed rotation gates instead of unitary gates.
Note that specifying a "decomposition" manually does not break:
Therefore, likely this error arises from how the decomposition is traced.
The text was updated successfully, but these errors were encountered: