Skip to content

Conversation

@JerryChen97
Copy link
Contributor

@JerryChen97 JerryChen97 commented Jul 17, 2025

Context:
Currently, about the shots source in the execution, there are three: set_shots, device, and shots= kwarg in qnode call.
To smoothify our immigration to set_shots, before the deprecation of devices' shots setup, we first deprecate the shots on qnode calls.

Description of the Change:
Source code:

  • Raise PennyLaneDeprecationWarning for shots in kwarg in QNode.construct who is the very last step before creating tapes
  • pennylane/optimize/shot_adaptive.py uses set_shots instead of qnode calls
  • improved set_shots value errors about the specific wrong types

About the test suites:

  • Tests who directly test this shots kwarg calling will be xfail'd and waiting for direct removal next release
  • Tests who used this kwarg call will be changed to use set_shots

Benefits:
One more step of decoupling; make the latter deprecations easier.

Possible Drawbacks:
Ecosys impact should be expected

Related GitHub Issues:
[sc-95617]

@JerryChen97 JerryChen97 changed the title Deprecate qnode call shots [WIP] Deprecate qnode call shots Jul 17, 2025
@JerryChen97 JerryChen97 self-assigned this Jul 17, 2025
@JerryChen97 JerryChen97 added the WIP 🚧 Work-in-progress label Jul 17, 2025
@JerryChen97 JerryChen97 marked this pull request as ready for review July 17, 2025 17:48
@JerryChen97
Copy link
Contributor Author

To see who's gonna fail!

@codecov
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.68%. Comparing base (a51adeb) to head (25aadaa).
⚠️ Report is 417 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7906      +/-   ##
==========================================
- Coverage   99.68%   99.68%   -0.01%     
==========================================
  Files         540      540              
  Lines       55386    55389       +3     
==========================================
+ Hits        55214    55216       +2     
- Misses        172      173       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

JerryChen97 added a commit to PennyLaneAI/catalyst that referenced this pull request Jul 22, 2025
**Context:**
See PennyLaneAI/pennylane#7906 for on-going
deprecation of the shots= kwarg of QNode calls. Now we can use set_shots
to assign the shots value to a qnode.

**Description of the Change:**
`frontend/test/pytest/test_measurements_shots_results.py`

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**
[[sc-95617](https://app.shortcut.com/xanaduai/story/95617)]
@JerryChen97 JerryChen97 requested a review from albi3ro July 23, 2025 19:31
@JerryChen97
Copy link
Contributor Author

I'll merge this after the lightning's merges, to try minimizing the impact

JerryChen97 added a commit to PennyLaneAI/pennylane-lightning that referenced this pull request Jul 23, 2025
**Context:**
See PennyLaneAI/pennylane#7906 for on-going
deprecation of the `shots=` kwarg of `QNode` calls. Now we can use
`set_shots` to assign the shots value to a qnode.

**Description of the Change:**
Changed two occurences inside `tests/test_native_mcm.py` with to
`set_shots`

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**
[[sc-95617](https://app.shortcut.com/xanaduai/story/95617)]

---------

Co-authored-by: ringo-but-quantum <[email protected]>
@JerryChen97 JerryChen97 added this pull request to the merge queue Jul 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jul 23, 2025
JerryChen97 added a commit to PennyLaneAI/qml that referenced this pull request Jul 23, 2025
**Title:**

**Summary:**
Due to deprecation happenning in
PennyLaneAI/pennylane#7906 we need to adjust the
usages in demos accordingly.

**Relevant references:**

**Possible Drawbacks:**

**Related GitHub Issues:**
[sc-95617]
----
If you are writing a demonstration, please answer these questions to
facilitate the marketing process.

* GOALS — Why are we working on this now?

*Eg. Promote a new PL feature or show a PL implementation of a recent
paper.*


* AUDIENCE — Who is this for?

*Eg. Chemistry researchers, PL educators, beginners in quantum
computing.*


* KEYWORDS — What words should be included in the marketing post?


* Which of the following types of documentation is most similar to your
file?
(more details
[here](https://www.notion.so/xanaduai/Different-kinds-of-documentation-69200645fe59442991c71f9e7d8a77f8))
    
- [x] Tutorial
- [ ] Demo
- [ ] How-to

---------

Co-authored-by: Christina Lee <[email protected]>
@JerryChen97 JerryChen97 enabled auto-merge July 23, 2025 21:26
@JerryChen97 JerryChen97 added this pull request to the merge queue Jul 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 23, 2025
@JerryChen97 JerryChen97 added this pull request to the merge queue Jul 24, 2025
Merged via the queue into master with commit a181089 Jul 24, 2025
54 checks passed
@JerryChen97 JerryChen97 deleted the shots-decoupling/deprecate_qnode_call_shots branch July 24, 2025 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-ready 👌 PRs which are ready for review by someone from the core team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants