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
Support multiple measurements and shot vectors in param_shift(... broadcast=True)
#5667
Open
dwierichs
wants to merge
27
commits into
master
Choose a base branch
from
param_shift-shot_vec-broadcast
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As name says. --------- Co-authored-by: Astral Cai <[email protected]>
**Context:** Some newly added test cases failing with legacy opmath **Description of the Change:** Skip these tests if new opmath is disabled: `test_measure_identity_no_wires` in `tests/devices/qubit/test_measure.py` `test_identity_on_no_wires_with_other_observables` in `tests/devices/qubit/test_sampling.py` `test_observables_on_no_wires_coeffs` in `tests/pauli/grouping/test_pauli_group_observables.py` `test_multiple_hamiltonian_expansion_finite_shots` in `tests/test_qnode_legacy.py` **Related Shortcut Issues:** [sc-62144] [sc-62143]
**Context:** 1. `Hamiltonian` does not remove ops from queue if `simplify=True` 2. `TrotterProduct` does not remove `Hamiltonian` **Description of the Change:** Manually dequeue said ops **Related Shortcut Issues:** [sc-62142] --------- Co-authored-by: Mudit Pandey <[email protected]>
### Before submitting Please complete the following checklist when submitting a PR: - [x] All new features must include a unit test. If you've fixed a bug or added code that should be tested, add a test to the test directory! - [x] All new functions and code must be clearly commented and documented. If you do make documentation changes, make sure that the docs build and render correctly by running `make docs`. - [x] Ensure that the test suite passes, by running `make test`. - [x] Add a new entry to the `doc/releases/changelog-dev.md` file, summarizing the change, and including a link back to the PR. - [x] The PennyLane source code conforms to [PEP8 standards](https://www.python.org/dev/peps/pep-0008/). We check all of our code against [Pylint](https://www.pylint.org/). To lint modified files, simply `pip install pylint`, and then run `pylint pennylane/path/to/file.py`. When all the above are checked, delete everything above the dashed line and fill in the pull request template. ------------------------------------------------------------------------------------------------------------ **Context:** `qml.counts` does not return the same `keys` with `dynamic_one_shot` and `defer_measurements`. **Description of the Change:** Cast `keys` to the type produced by `concretize`. **Benefits:** Consistent `keys`. **Possible Drawbacks:** Slight (likely unnoticeable) performance decrease since `NDArray` object cannot be preallocated. **Related GitHub Issues:** #5566 --------- Co-authored-by: David Wierichs <[email protected]>
- [x] Fix last open bug or open issue **Context:** Docs get out of sync over time. In particular, the output shape of gradient transforms applied to QNodes was changed in #4945 but not updated in the docs. **Description of the Change:** Update examples in docs of `qml.gradients` module. Also updates the `qml.kernels` docs, with a few very small changes. **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:**
2 very minor corrections to documentation added in this release
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 #5667 +/- ##
==========================================
- Coverage 99.68% 99.67% -0.01%
==========================================
Files 416 416
Lines 39049 38749 -300
==========================================
- Hits 38925 38624 -301
- Misses 124 125 +1 ☔ View full report in Codecov by Sentry. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context:
Shot vectors and multiple measurements are currently explicitly not supported when using
param_shift
with thebroadcast=True
option.In #5666 , a crucial subroutine
_evaluat_gradient
is being prepared to allow for support of these scenarios.Description of the Change:
Allow for shot vectors and/or multiple measurements in
param_shift(..., broadcast=true)
.Due to the changes in #5666 including unit tests for the relevant subroutines, this PR mostly is concerned with integration tests.
Benefits:
Feature parity with
broadcast=False
, allowing faster gradient evaluation.Possible Drawbacks:
Related GitHub Issues:
fixes #5598
[sc-62283]