-
Notifications
You must be signed in to change notification settings - Fork 603
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
Add deprecation warning to from_qasm #5882
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5882 +/- ##
==========================================
- Coverage 99.67% 99.66% -0.01%
==========================================
Files 422 422
Lines 40658 40367 -291
==========================================
- Hits 40525 40233 -292
- Misses 133 134 +1 ☔ View full report in Codecov by Sentry. |
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.
Looks good to me, thanks! 🚀
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
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.
LGTM! Just two small suggestions.
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
don't forget to add an entry in deprecations.rst! |
ooops, will do. |
if measurements is False: | ||
warnings.warn( | ||
"The current default behaviour of removing measurements in the QASM code is " | ||
"deprecated. Set measurements=None to keep the existing measurements in the QASM " | ||
"code or set measurements=[] to remove them from the returned circuit. Starting " | ||
"in version 0.38, measurements=None will be the new default.", | ||
qml.PennyLaneDeprecationWarning, | ||
) | ||
measurements = [] |
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.
Here I was expecting to only raise a warning if measurements is False
and there are measurements present in the QASM circuit. Is that something we could determine?
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.
I'll make another PR to do that.
**Context:** Previously, the QASM circuit converted to PL had no measurements (even if the circuit ended with measurements, the assumption was we remove those and add PL measurements once the circuit is converted). In the UnitaryHack, a contributor added the option to specify measurements when converting a circuit `from_qasm`, like the `from_qiskit` function. In doing so, the `from_qasm` circuit took on the current `from_qiskit` convention. Calling `from_qasm(qasm_str)` previously returned only the operators, and now returns operators + measurements. This is a breaking change with no deprecation cycle. PennyLaneAI/pennylane-qiskit#469 **Description of the Change:** Adds a deprecation warning to `from_qasm` [sc-66318] --------- Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com> Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Context:
Previously, the QASM circuit converted to PL had no measurements (even if the circuit ended with measurements, the assumption was we remove those and add PL measurements once the circuit is converted).
In the UnitaryHack, a contributor added the option to specify measurements when converting a circuit
from_qasm
, like thefrom_qiskit
function. In doing so, thefrom_qasm
circuit took on the currentfrom_qiskit
convention. Callingfrom_qasm(qasm_str)
previously returned only the operators, and now returns operators + measurements. This is a breaking change with no deprecation cycle.PennyLaneAI/pennylane-qiskit#469
Description of the Change:
Adds a deprecation warning to
from_qasm
[sc-66318]