-
Notifications
You must be signed in to change notification settings - Fork 586
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
Daily rc sync to master #5665
Merged
Merged
Daily rc sync to master #5665
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 <astral.cai@xanadu.ai>
**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 <mudit.pandey@xanadu.ai>
### 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 <david.wierichs@xanadu.ai>
- [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
**Context:** Fixes latest failures in the legacy opmath tests in the plugin test matrix. **Description of the Change:** 1. `convert_to_opmath` now dequeues the original op. 2. Skip test with `I()` when new opmath is disabled.
**Context:** Shot vectors together with the `broadcast=True` feature of `param_shift` suffers from the bug #5598 . For some shot vector lengths, this bug causes silent wrong results, for other lengths it causes a non-comprehensive error. **Description of the Change:** This PR explicitly disallows this combination and raises a `NotImplementedError`. A proper fix is in the works. **Benefits:** No silently wrong results and more comprehensive error message. **Possible Drawbacks:** **Related GitHub Issues:** #5598 Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
**Context:** With new opmath enabled, `TrotterProduct` does not automatically simplify the input Hamiltonian. **Description of the Change:** Adding a warning to let the user know of this behaviour [sc-62232]
…use MCMs in measurements (#5610) **Context:** `defer_measurements` leaves `MeasurementValue`s in the terminal measurement processes if they are present. This is not friendly with the drawer as the classical wires for those measurement values do not exist when using `defer_measurements`. This PR adds a "hack" fix so that the drawer/MPL drawer work with this scenario. **Description of the Change:** Add `transform_deferred_measurements_tape` util function, which replaces any `MeasurementValue`s present in the tape after applying `defer_measurements` with wires. This transform is only applied in `tape_text` and `tape_mpl`. **Benefits:** Drawer works better with MCMs **Possible Drawbacks:** Hacky fix, technical debt to implement cleaner fix later **Related GitHub Issues:** #5588
# Required fixes for version 0.36 This PR contains all the required changes coming from [quality checks](https://docs.google.com/spreadsheets/d/1nU7bw0Gx4qIkiSrjWPHlhRuokxBGZW3KQoqMamLcRfY/edit#gid=875363335)
### The second round of necessary modifications to docs for PL 0.36. Some docs have changed to match the output and allow code execution.
**Context:** Now, we technically allow something like `LinearCombination([1,2], qml.X(0)@qml.Y(1))`, but that's probabably doesn't do what the user was actually expecting, and this syntax could lead to some very difficult to diagnose bugs. **Description of the Change:** Explicitly forbid the above syntax. **Benefits:** Preventing people from doing weird things accidentally. **Possible Drawbacks:** More validation. Maybe someone actually does want the strange behaviour. **Related GitHub Issues:** [sc-62162]
**Context:** As more devices switch to the new device interface, users may request properties or behaviours that are no longer there. The current error messages do not sufficiently alert users to the fact that the device interface has changed. **Description of the Change:** Make a more informative error when trying to set the shots or access a non-existant attribute. **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:**
**Context:** A missing check in `has_diagonalizing_gates` was causing `CompositeOp` instances to sometimes incorrectly return `True` for `has_diagonalizing_gates`, i.e.: ``` >>> op1 = qml.PauliZ(0) >>> op2 = qml.Rot(1.2, 2.3, 3.4, wires=0) >>> op3 = qml.IsingZZ(4.32, wires=("a", "b")) >>> op = qml.prod(op1, op2, op3) >>> op.has_diagonalizing_gates # should be False True ``` **Description of the Change:** Add the missing check to create consistency between for what base operators a `CompositeOp` can return `diagonalizing_gates`, and what for what operators it returns `True` for `has_diagonalzing_gates`. Removes the `xfail` for the related test.
As name says. This PR does not update the version of jax against which we test pennylane. [The CI](https://github.com/PennyLaneAI/pennylane/pull/5589/checks?sha=c30baa32e419bbe556d7f9bac1fdc6fb85aceff4) from commit [c30baa3](c30baa3) shows that the tests pass with the changes in this PR with jax 0.4.26. --------- Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
) **Context:** When adjoint differentiation is used, a warning is incorrectly raised when the parameters of a measured observable is not actually trainable. **Description of the Change:** Update the `validate_adjoint_trainable_params` to use `qml.operation.is_trainable` instead of `tape.trainable_params`.
Some outputs had a different wire order than reported in the documentation. Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Noticed that `lie_closure` was not numerically stable after a [user report](https://discuss.pennylane.ai/t/calculation-of-dynamical-lie-algebra/4309/3) Fixing that by - [x] using the slightly slower but more stable `qml.math.linalg.solve` over `qml.math.linalg.inv` - [x] exposing `tol` as kwarg to the user - [x] setting the default of `tol` higher (two orders of magnitude higher as the machine precision of `_M`'s dtype)
…`qcut.PrepareNode` (#5613) **Context:** `MeasureNode` and `PrepareNode` automatically have a UUID (#2224), which is being printed in tape text (#4749) **Description of the Change:** Update the docs of the `qcut` module to reflect some minor changes ,mostly in formatting/tape printing default settings. Update the `label` method of `MeasureNode` and `PrepareNode` to not include their `id`. **Benefits:** Updated docs. Nicely printing qcut tape texts **Possible Drawbacks:** **Related GitHub Issues:**
**Context:** Rename the accepted values for the method keyword argument in the TrotterProduct class to be more verbose. **Description of the Change:** Change: - `method="one-norm"` --> `method="one-norm-bound"` - `method="commutator"` --> `method="commutator-bound"`
Making more clear Reflection docs --------- Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Astral Cai <astral.cai@xanadu.ai> Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>
**Context:** The release notes need to be tidied in time for the 0.36 release on May 7th. **Description of the Change:** This is the second phase of changes to the release notes after #5554, where aim to finalize a polished version. --------- Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com> Co-authored-by: Isaac De Vlugt <isaacdevlugt@gmail.com> Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Some links in new opmath page did not work. Used https://github.com/bskinn/sphobjinv to identify the right objects. The links to `Hamiltonian` class dont work because in `latest` there is no rendered version of that doc --------- Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
As name says. See commit descriptions for details about changes.
### Before submitting Please complete the following checklist when submitting a PR: - [ ] 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! - [ ] 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`. - [ ] Ensure that the test suite passes, by running `make test`. - [ ] Add a new entry to the `doc/releases/changelog-dev.md` file, summarizing the change, and including a link back to the PR. - [ ] 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:** **Description of the Change:** **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: trbromley <brotho02@gmail.com> Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com> Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com> Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Due to the dispatch of `qml.Hamiltonian` that involves removing `Hamiltonian` from the top level in `pennylane/__init__.py`, the doc was not displayed anymore. This fix "hacks" sphinx to add the missing obect back, at least for sphinx. Optional separate issue: A user seeking out the `qml.Hamiltonian` docs at the top level may be confused because this now dispatches to `LinearCombination` but this is not mentioned there. Added a warning to avoid that confusion. --------- Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
When `ops` is a `Tensor`, this line: ``` if len(coeffs) != len(ops) ``` raises an error because `Tensor` does not have `len`. Moving the `isinstance` checks for `ops` to the beginning of the function.
**Description of the Change:** The minimum compiler version needs to be updated due to device API update. This is the last PR to be merged to the release candidate as it depends on Catalyst being updated. --------- Co-authored-by: David Ittah <dime10@users.noreply.github.com> Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
…o rc_2024-05-07-02-51-20
astralcai
reviewed
May 7, 2024
astralcai
reviewed
May 7, 2024
astralcai
approved these changes
May 7, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5665 +/- ##
==========================================
- Coverage 99.69% 99.68% -0.01%
==========================================
Files 412 412
Lines 38619 38350 -269
==========================================
- Hits 38500 38231 -269
Misses 119 119 ☔ View full report in Codecov by Sentry. |
albi3ro
approved these changes
May 7, 2024
mudit2812
added a commit
that referenced
this pull request
May 8, 2024
Automatic sync from the release candidate to master during a feature freeze. --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> Co-authored-by: Astral Cai <astral.cai@xanadu.ai> Co-authored-by: Vincent Michaud-Rioux <vincentm@nanoacademic.com> Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com> Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai> Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com> Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com> Co-authored-by: Isaac De Vlugt <isaacdevlugt@gmail.com> Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com> Co-authored-by: trbromley <brotho02@gmail.com> Co-authored-by: erick-xanadu <110487834+erick-xanadu@users.noreply.github.com> Co-authored-by: David Ittah <dime10@users.noreply.github.com> Co-authored-by: GitHub Actions Bot <>
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.
Automatic sync from the release candidate to master during a feature freeze.