-
Notifications
You must be signed in to change notification settings - Fork 632
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
Deprecate tape
and qtape
properties on the QNode
#6583
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6583 +/- ##
=======================================
Coverage 99.44% 99.45%
=======================================
Files 450 450
Lines 42088 42088
=======================================
+ Hits 41856 41857 +1
+ Misses 232 231 -1 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
…1266) Summary: Updating deprecated code that was introduced from a recent deprecation PennyLaneAI/pennylane#6583. [sc-76836]
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.
❤️
Co-authored-by: Mudit Pandey <mudit.pandey@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.
Looks good. There are a couple of comments that are blocking approval from me.
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
…nnylane into deprecate-tape-properties
**Context:** Many tests incorrectly rely on the `tape` and `qtape` properties to access information during tests. With these properties deprecated in #6583, deprecation warnings in the affected test files have been suppressed. This PR aims to replace all instances of deprecated code with the correct code. **Description of the Change:** Tests should construct the tape dynamically using `construct_tape` rather than use the deprecated properties. **Benefits:** Better testing and code maintainability. **Possible Drawbacks:** I’m still a bit unsure about the changes in tests/workflow/interfaces/qnode/. The lines I deleted were originally a workaround to further verify QNode interfacing. However, the primary goal of the tests in this folder isn’t to check gradient accuracy but rather to ensure proper interfacing with the QNode architecture (e.g., verifying data types and result shapes). Since the property being used should now be considered private, relying on it in tests isn’t best practice—hence the deletion. [sc-78317] --------- Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
**Context:** Many tests incorrectly rely on the `tape` and `qtape` properties to access information during tests. With these properties deprecated in #6583, deprecation warnings in the affected test files have been suppressed. This PR aims to replace all instances of deprecated code with the correct code. **Description of the Change:** Tests should construct the tape dynamically using `construct_tape` rather than use the deprecated properties. **Benefits:** Better testing and code maintainability. **Possible Drawbacks:** I’m still a bit unsure about the changes in tests/workflow/interfaces/qnode/. The lines I deleted were originally a workaround to further verify QNode interfacing. However, the primary goal of the tests in this folder isn’t to check gradient accuracy but rather to ensure proper interfacing with the QNode architecture (e.g., verifying data types and result shapes). Since the property being used should now be considered private, relying on it in tests isn’t best practice—hence the deletion. [sc-78317] --------- Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
Context:
The QNode currently has
QNode.tape
andQNode.qtape
properties, which track the last tape generated during a construct call. Users can check these to verify what was executed most recently.Now, we’ve added
construct_tape(qnode)(*args, **kwargs)
in the workflow module as a preferred method for constructing tapes. This function creates a tape without modifying the QNode, ensuring it doesn’t interfere with other parts of the codebase.Description of the change
QNode.tape
andQNode.qtape
in the PennyLane source code.Found references in,
tape
andqtape
properties inQNode
qml#1266tape
andqtape
properties inQNode
pennylane-qiskit#602No references in,
Benefits: Removes problems and confusion with having a mutable tape property.
Possible Drawbacks: None
[sc-76836]