Skip to content
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

Update deprecated usage of tape and qtape properties in QNode #602

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

andrijapau
Copy link
Contributor

Summary:

Updating deprecated code that was introduced from a recent deprecation PennyLaneAI/pennylane#6583.

[sc-76836]

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0122cce) to head (9db5013).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #602   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          868       868           
=========================================
  Hits           868       868           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrijapau andrijapau merged commit f1ac194 into master Nov 14, 2024
10 checks passed
@andrijapau andrijapau deleted the update-deprecated-qnode-property branch November 14, 2024 20:42
andrijapau added a commit to PennyLaneAI/pennylane that referenced this pull request Nov 18, 2024
**Context:**

The QNode currently has `QNode.tape` and `QNode.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**

- _Hopefully_ removed all calls to `QNode.tape` and `QNode.qtape` in the
PennyLane source code.
- Since many tests rely on these properties to access tape information,
I’ve temporarily suppressed the warnings. This needs to be revisited in
the backlog and gradually updated to use the preferred code [sc-78317].

Found references in,
- QML: PennyLaneAI/qml#1266
- Qiskit:  PennyLaneAI/pennylane-qiskit#602

No references in,
- Lightning
- Catalyst
- AQT
- IONQ
- Qulacs
- Cirq

**Benefits:** Removes problems and confusion with having a mutable tape
property.

**Possible Drawbacks:** None

[sc-76836]

---------

Co-authored-by: Christina Lee <[email protected]>
Co-authored-by: Mudit Pandey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants