I have tried many different circuits. Currently it seems to me that whether grad succeeds or not is only a function of whether the circuit contains at least one of RX, RY, RZ . As soon as the circuit has none of them, grad will fail.
It is further suspected that this is an edge case bug for asking for the gradients where circuits have no trainable parameters.
jax.grad
(andcatalyst.grad
) sometimes randomly fails on a qjit-ted function containing a qnode:however, if the circuit includes the RZ gate then the error disappears:
I have tried many different circuits. Currently it seems to me that whether grad succeeds or not is only a function of whether the circuit contains at least one of RX, RY, RZ . As soon as the circuit has none of them, grad will fail.
It is further suspected that this is an edge case bug for asking for the gradients where circuits have no trainable parameters.
Note: without
qjit
everything works as expected: