-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
QPY can't serialize UCRZGate
#7847
Comments
The problem is the https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/qpy/binary_io/circuits.py#L240-L257 so that qpy knows that it needs to handle the creation of them separately as they're not built in the standard way. Secondly it might require updating this function if we need to include extra attributes in the serialization of the gate https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/qpy/binary_io/circuits.py#L382 function to enable creating a new equivalent instance in deserialization (I'm thinking for a generic |
I see. That sounds like my next project :D Can I assign myself on this issue? I will take a closer look at QPY later. For the purpose of creating the Grover tutorial, I am going to use decomposed circuits below UCRZ level which I have tested working. |
This commit fixes the deserialization of the UCRX, UCRY, and UCRZ gates. These gates aren't constructed in the standard way as other gate objects where the parameters are passed directly as args to the class constructor. Instead they behave the same as Initialize and the params are passed as a list to the constructor to make a new gate object. This commit fixes the handling in deserialization to treat these gates the same as Initialize so that it can be properly deserialized by qpy.load(). Fixes Qiskit#7847
This commit fixes the deserialization of the UCRX, UCRY, and UCRZ gates. These gates aren't constructed in the standard way as other gate objects where the parameters are passed directly as args to the class constructor. Instead they behave the same as Initialize and the params are passed as a list to the constructor to make a new gate object. This commit fixes the handling in deserialization to treat these gates the same as Initialize so that it can be properly deserialized by qpy.load(). Fixes #7847 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit fixes the deserialization of the UCRX, UCRY, and UCRZ gates. These gates aren't constructed in the standard way as other gate objects where the parameters are passed directly as args to the class constructor. Instead they behave the same as Initialize and the params are passed as a list to the constructor to make a new gate object. This commit fixes the handling in deserialization to treat these gates the same as Initialize so that it can be properly deserialized by qpy.load(). Fixes #7847 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 2f182f6)
This commit fixes the deserialization of the UCRX, UCRY, and UCRZ gates. These gates aren't constructed in the standard way as other gate objects where the parameters are passed directly as args to the class constructor. Instead they behave the same as Initialize and the params are passed as a list to the constructor to make a new gate object. This commit fixes the handling in deserialization to treat these gates the same as Initialize so that it can be properly deserialized by qpy.load(). Fixes #7847 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 2f182f6) Co-authored-by: Matthew Treinish <[email protected]>
Environment
What is happening?
While developing a Grover's tutorial for the new Qiskit Runtime primitives, I found a bug where the grover circuit submitted to runtime provider with sampler program return
TypeError: __init__() takes 2 positional arguments but 5 were given
. After some investigation, I have narrowed down the issue toUCRZGate
which is part of the Grover operator in the grover circuit.How can we reproduce the issue?
qpy code based on this answer by @mtreinish on StackExchange.
What should happen?
Circuits containing
UCRZGate
should be able to be serialized by QPY.Any suggestions?
No response
The text was updated successfully, but these errors were encountered: