-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Verification is not allowing differentiation of non-differentiable gates #1065
Comments
Note that if I set >>> dcost(x)
dcost:13:3: error: 'func.func' op cloned during the gradient pass is not free of quantum ops:
"func.func"() <{function_type = (tensor<6xi64>, tensor<2xf64>, index) -> tensor<?xf64>, sym_name = "cost.qgrad", sym_visibility = "private"}> ({
^bb0(%arg0: tensor<6xi64>, %arg1: tensor<2xf64>, %arg2: index):
%0 = "arith.constant"() <{value = sparse<15, -1.5707963267948966> : tensor<16xf64>}> : () -> tensor<16xf64>
... |
@erick-xanadu I think this is related to our interface discussion on your PR, since the new gates aren't implementing one of the quantum gate interfaces, the gradient passes would need to remove them explicitly. |
The main problem mentioned here might be difficult to solve quickly, we need a way to track which gate parameters came from differentiated function arguments. A workaround would be completing the decomposition of gates not supported for differentiation, which we want anyways. I believe that should be fairly quick to implement. While this is inefficient in some cases (unnecessary decomposing), it does match the previous behaviour for StatePrep. |
I agree. However, I don't see how we got here because verification should have caught this error similar to above. |
I don't know if verification for parameter-shift has been implemented yet. |
A naive verification for parameter shift is implemented, just confirming that |
If the parameter-shift bug is an easy fix, should I split this into its own issue separate from the verification discussion? |
(we can treat this now as two separate bugs) |
The new gradient verification is slightly too overzealous, and won't allow circuits to be differentiated even when the operation which is not supported for differentiation is not being differentiated:
In this case, it is failing to allow this circuit to pass verification even though
BasisState
is not being differentiated.Previously, this example would work fine, since
BasisState
was always being decomposed down to non-parametrizable gates (qml.X
).Note that this is currently affecting our VQE + catalyst demos, and they are no longer executable. A temporary workaround I can do is:
but this is not ideal.
The text was updated successfully, but these errors were encountered: