-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Feat] Transpile.reverse for QuantumCircuit and AbstractBlock #45
Conversation
Add constructors
Digital decomposition, operations and Braket backend
add utils.py file
* Add README. * Remove useless heading.
Co-authored-by: Kaonan Micadei <[email protected]> Co-authored-by: Vytautas Abramavicius <[email protected]>
* state preparation * logging * register * execution helpers * qubit support * serialization * typing * wavefunction overlaps Co-authored-by: Aleksander Wennersteen <[email protected]> Co-authored-by: Mario Dagrada <[email protected]> Co-authored-by: Vincent Elfving <[email protected]> Co-authored-by: Dominik Seitz <[email protected]> Co-authored-by: Joao Moutinho <[email protected]> Co-authored-by: Vytautas Abramavicius <[email protected]> Co-authored-by: Niklas Heim <[email protected]> Co-authored-by: Roland Guichard <[email protected]>
* state preparation * logging * register * execution helpers * qubit support * serialization * typing * wavefunction overlaps Co-authored-by: Aleksander Wennersteen <[email protected]> Co-authored-by: Mario Dagrada <[email protected]> Co-authored-by: Vincent Elfving <[email protected]> Co-authored-by: Dominik Seitz <[email protected]> Co-authored-by: Joao Moutinho <[email protected]> Co-authored-by: Vytautas Abramavicius <[email protected]> Co-authored-by: Niklas Heim <[email protected]> Co-authored-by: Roland Guichard <[email protected]>
Co-authored-by: Aleksander Wennersteen <[email protected]> Co-authored-by: Mario Dagrada <[email protected]> Co-authored-by: Vincent Elfving <[email protected]> Co-authored-by: Gert-Jan Both <[email protected]>
* Update pre-commits. * Gather examples and notebooks tests on schedule. * Remove obsolete files. * Test against Python 3.9 and 3.10.
Co-authored-by: Mario Dagrada <[email protected]> Co-authored-by: Niklas Heim <[email protected]> Co-authored-by: Dominik Seitz <[email protected]> Co-authored-by: Roland Guichard <[email protected]> Co-authored-by: Joao Moutinho <[email protected]> Co-authored-by: Vytautas Abramavicius <[email protected]>
* Docs suggestions. * Fix typo. * Latest changes. * Latest changes. * Trigger docs tests on CI. * More files to docs. * fix circuit drawings * quadance to qadance * More docs improvements. * fix docs build * More suggestions and run test-docs again. * update pulser examples * remove mkdocs-jupyter * update pulser example * More improvements. --------- Co-authored-by: jpmoutinho <[email protected]> Co-authored-by: João P. Moutinho <[email protected]> Co-authored-by: Vytautas Abramavicius <[email protected]>
* update readme * remove admonition * lint --------- Co-authored-by: Roland Guichard <[email protected]>
* Improvements to the Pulser backend documents + change defaults * Shorter names to the workflows * Linting * Improvements to the docs * Added AnalogRZ operation to the enumeration * Go back to idealized device --------- Co-authored-by: Roland Guichard <[email protected]>
Let’s add a few tests (including nested chains), then I’m good with this:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dominikandreasseitz. I am not sure what you intend to do here. Also, I am a bit worried that your reverse operation might not be allowed if non-commutative ops are in play.
|
||
@singledispatch | ||
def reverse(x: QuantumCircuit | AbstractBlock) -> QuantumCircuit | AbstractBlock: | ||
"""Reverses a QuantumCircuit or AbstractBlock.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by "reverse" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what this is supposed to accomplish is just reversing a circuit in the same way that you would reverse a list. we need it (at some point) for the adjoint method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so basically this is taking the adjoint of a circuit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so, I'd rename it adjoint
or reuse the current dagger
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precisely, the dagger
method should accomplish the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no it doesnt exactly, it reverses the circuit, yes, but it also renames all the parameters to "-{parameter_name}" which its not what we want. we need the same parameter names to compute the gradients in the backward pass of the adjoint method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move this to #78
@dominikandreasseitz please add a small description to the MR. If there is not corresponding issue, it is better to always add it as a best practice. |
moving to #78 |
In order to perform adjoint differentiation, we need to reverse the circuit in the backward pass.