-
Notifications
You must be signed in to change notification settings - Fork 657
Add qml.to_openqasm
transform
#7393
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
base: master
Are you sure you want to change the base?
Conversation
Just thinking here: would it make sense it to live in the |
Co-authored-by: Yushao Chen (Jerry) <[email protected]>
Ok thank you Christina! I move it to the |
@albi3ro I think this is a good idea! Since this is not really a 'transform' but more a new public function, it would probably be confusing to put it in the |
qml.to_openqasm
transformqml.to_qasm
function
qml.to_qasm
functionqml.to_openqasm
transform
I added some unit tests checking the OpenQASM 2.0 code for a few different circuits but actually most of the work done by the transform already has an extensive set of tests for the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7393 +/- ##
=======================================
Coverage 99.69% 99.69%
=======================================
Files 529 529
Lines 50610 50621 +11
=======================================
+ Hits 50455 50466 +11
Misses 155 155 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR looks great! 🎉
I only have a few minor comments/observations. Please let me know what you think! Thanks @SimoneGasperini : )
# pylint: disable=import-outside-toplevel | ||
from pennylane.workflow import construct_tape |
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.
As a reference to other reviewers, this is just a trick to avoid circular import issues. We could address this as part of this story
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.
More work for @andrijapau when he's back from vacation 😆
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
This PR adds a transform to make the conversion of a quantum circuit into the corresponding OpenQASM 2.0 program easier and more user-friendly. The
qml.to_openqasm
function is implemented in a newopenqasm
module under theqml.transforms
subpackage. Not sure this is the right location in the Pennylane repository.A quite extensive set of unit and integration tests for the
QuantumScript.to_openqasm
method is already available in test_qasm.py. I will add a detailed description of what the transform is doing in the docstring, including a simple usage example.[sc-83360]