-
Notifications
You must be signed in to change notification settings - Fork 603
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
Upgrade and generalise basis state preparation #6021
Conversation
Hello. You may have forgotten to update the changelog!
|
Just making a note here that the failed SPSA test is fixed with this PR: #6027 |
[sc-68521] |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6021 +/- ##
==========================================
- Coverage 99.67% 99.65% -0.02%
==========================================
Files 432 432
Lines 41839 41680 -159
==========================================
- Hits 41702 41536 -166
- Misses 137 144 +7 ☔ View full report in Codecov by Sentry. |
BasisEmbedding
an alias of BasisState
BasisEmbedding
an alias of BasisState
BasisEmbedding
an alias of BasisState
BasisEmbedding
an alias of BasisState
BasisEmbedding
an alias of BasisState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @KetpuntoG , looks good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of final minor comments, but looks good otherwise.
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
…legacy device for MPI LGPU (#864) ### 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 [`tests`](../tests) 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 `.github/CHANGELOG.md` file, summarizing the change, and including a link back to the PR. - [x] Ensure that code is properly formatted by running `make format`. When all the above are checked, delete everything above the dashed line and fill in the pull request template. ------------------------------------------------------------------------------------------------------------ **Context:** - PR PennyLaneAI/pennylane#6021 removed code duplication for `BasisEmbedding` and `BasisState`. As the result `BasisState` no longer decomposes to `BasisStatePreparation`. This PR updates Python unit tests to support this generalization of basis state preparation. - PR PennyLaneAI/pennylane#6046 added a facade wrapper class for "legacy" devices. This PR is a follow up to PR #839 updating Multi-GPU LGPU device and tests. **Description of the Change:** **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
…ases (PennyLaneAI/pennylane#6021). We update our tests to agree with them.
**Context:** PL recently changed error messages for bad stateprep/basisstate use cases (PennyLaneAI/pennylane#6021). We update our tests to agree with them. **Benefits:** Frontend tests `test_skip_initial_stateprep/TestPossibleErrors` can pass
…legacy device for MPI LGPU (#864) ### 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 [`tests`](../tests) 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 `.github/CHANGELOG.md` file, summarizing the change, and including a link back to the PR. - [x] Ensure that code is properly formatted by running `make format`. When all the above are checked, delete everything above the dashed line and fill in the pull request template. ------------------------------------------------------------------------------------------------------------ **Context:** - PR PennyLaneAI/pennylane#6021 removed code duplication for `BasisEmbedding` and `BasisState`. As the result `BasisState` no longer decomposes to `BasisStatePreparation`. This PR updates Python unit tests to support this generalization of basis state preparation. - PR PennyLaneAI/pennylane#6046 added a facade wrapper class for "legacy" devices. This PR is a follow up to PR #839 updating Multi-GPU LGPU device and tests. **Description of the Change:** **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
This PR complete part of this story: [[sc-68521](https://app.shortcut.com/xanaduai/story/68521)] Goal: `BasisEmbedding` is an alias of `BasisState`. This way, we don't have duplicate code that does the same thing. In unifying this, I have had to modify some tests due to: - `BasisEmbedding` and `BasisState` throw errors such as "incorrect length" with different messages. Now it will always be the same. (test modified for this reason: `test_default_qubit_legacy.py`, `test_default_qubit_tf.py` `test_default_qubit_torch.py`, `test_state_prep.py`, `test_all_singles_doubles.py` and test_uccsd`) - In `BasisEmbedding`, errors were thrown in `__init__` while in BasisState in `state_vector`. Now they are unified in `__init__`. For this reason, there were tests where the operator was not initialized correctly but no error was thrown since `state_vector` was not being called but now they are detected. To correct this, I have modified the tests: `test_qscript.py`, `test_state_prep.py`, - Now `BasisState` does not decompose `BasisStatePreparation` since we are going to deprecate it. This causes the number of gates after expanding to be affected. In this case I had to modify some test in `test_tape.py`. This PR also solves: - [issue 6008](#6008) - [issue 6007](#6007) - [issue 6006](#6006) --------- Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
This PR complete part of this story: [sc-68521]
Goal:
BasisEmbedding
is an alias ofBasisState
. This way, we don't have duplicate code that does the same thing.In unifying this, I have had to modify some tests due to:
BasisEmbedding
andBasisState
throw errors such as "incorrect length" with different messages. Now it will always be the same. (test modified for this reason:test_default_qubit_legacy.py
,test_default_qubit_tf.py
test_default_qubit_torch.py
,test_state_prep.py
,test_all_singles_doubles.py
and test_uccsd`)In
BasisEmbedding
, errors were thrown in__init__
while in BasisState instate_vector
. Now they are unified in__init__
. For this reason, there were tests where the operator was not initialized correctly but no error was thrown sincestate_vector
was not being called but now they are detected. To correct this, I have modified the tests:test_qscript.py
,test_state_prep.py
,Now
BasisState
does not decomposeBasisStatePreparation
since we are going to deprecate it. This causes the number of gates after expanding to be affected. In this case I had to modify some test intest_tape.py
.This PR also solves:
Related Shortcut Stories:
[sc-69103]