-
Notifications
You must be signed in to change notification settings - Fork 604
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 upload.yml to use codecov token. #5661
Closed
Closed
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
**Context:** Currently, `qml.Device` and `qml.devices.Device` are abstract base classes for `PennyLane` devices. However, the former was created about 6 years ago, and the second one about 14 months ago. In particular, the second one follows the [new design API](https://docs.pennylane.ai/en/stable/code/api/pennylane.devices.Device.html), and it is the current default choice. The first one remained for historical reasons and not to break existing code. **Description of the Change:** A new `qml.devices.LegacyDevice` alias is introduced for the old `qml.Device`, making it easier to distinguish between the two. When importing pennylane, in `pennylane/devices/__init__.py` the old device is imported as `LegacyDevice`. Additionally, in some parts of the source code, the old `qml.Device` has been replaced with `qml.devices.LegacyDevice` to facilitate readability. *Important note*: The `qml.Device` class is used extensively in the source code, docs, and tests. In this PR, we just replaced such working with the new alias in some cases (such as checks) to show how it can improve readability. In particular, we didn't modify `tests`, docs, and `.rst` files. The purpose of this PR is to introduce an alias, not to replace `qml.Device` entirely. **Benefits:** This feature enhances readability in the code, and many developers have requested it. It can be confusing to infer the difference between `qml.Device` (old device API) and `qml.devices.Device` (new device API). Now, it is clear that we have two different APIs. The following code snippet shows how this new alias can be used: ``` >>> import pennylane as qml >>> qml.devices.LegacyDevice pennylane._device.Device >>> qml.Device pennylane._device.Device >>> qml.Device == qml.devices.LegacyDevice True ``` **Possible Drawbacks:** None that I can think of right now. **Related GitHub Issues:** None. [sc-57332]
…fer_measurements` and postselection (#5558) **Context:** Deferring measurements implies that we replace operations classically controlled on mid-circuit measurement values by standard controlled quantum operations. If postselection is used, we can save on the number of control wires and on the overall number of operations queued by `defer_measurements`. Note that a single postselected measurement can reduce the number of operations drastically, depending on the classical coprocessing. **Description of the Change:** This PR changes `defer_measurements` to only queue operations that are not reduced to the identity because of postselection rules. In addition, control wires corresponding to postselected measurements are excluded, as their value is known at transform time already. To achieve the above, this PR adds a method `_postselected_items` to `MeasurementValue` that only returns a (pruned) branch together with the classical processing result of the non-pruned branch. **Benefits:** Reduction of operation count and complexity when using `defer_measurements` with postselection. **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
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: GitHub Actions Bot <> Co-authored-by: Christina Lee <christina@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:** **Description of the Change:** **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
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: GitHub Actions Bot <>
**Context:** We've been seeing a lot of stochastic failures lately. We have random tests that rely on the global numpy rng. Adding new tests or changing around the order tests are run in can cause tests to randomly fail, eating large amounts of CI and developer time. **Description of the Change:** Sets a global numpy seed before each test. **Benefits:** No more CI flakiness. **Possible Drawbacks:** Might still be a "special" seed, with failures on other seed values. We should periodically update this seed just for testing robustness. **Related GitHub Issues:**
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: GitHub Actions Bot <>
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: GitHub Actions Bot <>
**Context:** While `qml.equal` has been incredibly helpful in helping us compare operators, measurements, and tapes, it can sometimes be rather difficult to determine *why* two operations are not equal. This new `assert_equal` function will raise and `AssertionError` with context, making it easier to debug failures occuring in tests or scripts. **Description of the Change:** This PR just sets up the framework by: 1) Allowing the `_equal` function to return either a bool or str. 2) Making `qml.equal` interpret a string as `False` 3) Adding `assert_equal` to raise an `AssertionError` from the output of `_equal` 4) Implementing the bool-> str conversion for `BasisRotation` `BasisRotation` is as it an edge case where I can demonstrate what we want these functions to look like without taking away the core part of the work. **Benefits:** Easier debugging. **Possible Drawbacks:** More to maintain. **Related GitHub Issues:** --------- Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
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: GitHub Actions Bot <>
Hello. You may have forgotten to update the changelog!
|
Alex-Preciado
approved these changes
May 6, 2024
jay-selby
approved these changes
May 6, 2024
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.
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 thechange, and including a link back to the PR.
The PennyLane source code conforms to
PEP8 standards.
We check all of our code against Pylint.
To lint modified files, simply
pip install pylint
, and thenrun
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: