-
Notifications
You must be signed in to change notification settings - Fork 578
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 measurements tests for DQ2; create legacy tests folder #4574
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4574 +/- ##
==========================================
- Coverage 99.65% 99.65% -0.01%
==========================================
Files 376 376
Lines 33148 33156 +8
==========================================
+ Hits 33035 33042 +7
- Misses 113 114 +1
☔ View full report in Codecov by Sentry. |
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.
I have some thoughts about the changes to qinfo but those are probably more relevant for transforms related discussions rather than device related discussions. Have a rocket 🚀
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.
🚀
**Context:** Measurement tests are focused on legacy devices, but we should use the new device API for these tests. **Description of the Change:** Here's what I did, chronologically: 1. copy-paste every measurement test file into the `legacy` sub-folder 2. change the original files to use `default.qubit` (not DQL), change `default.qubit` to point to DQ2, fix tests so they work with DQ2 (they all passed) 3. Put back `default.qubit` to point to DQL, re-run non-legacy tests to see which ones fail, mark those as xfail (for now) 4. Remove all tests in the `legacy` folder that double-cover anything (in other words, any tests that didn't use DQL) Step 2 above involved some changes to PennyLane source code, and they are: 1. Introduce `MutualInfoMP.map_wires` 2. Change the qinfo transforms to use tape wires if device wires aren't present (I will probably revert this once device wires are supported for DQ2) 3. Fix `sampling.py` to not squeeze any CountsMP result (batched results also shouldn't be squeezed, but they are lists of dicts instead of just dicts) 4. EDIT: Update `ProbabilityMP.marginal_prob` to just return `prob` if `self.wires` is None. This was commented out before, and I'm not sure why. **Benefits:** - Migrating to DQ2 will be much easier, and we'll have better test coverage for measurements with the new device API - `qml.probs()` did not work with DQ2 before this little change D: **Possible Drawbacks:** Slightly more tests. Think of this as effectively adding one more device to test with whenever doing device integration tests. **Follow-Up:** I made [this story](https://app.shortcut.com/xanaduai/story/44915/update-setup-py-to-point-default-qubit-to-defaultqubit2) and mentioned the removal of xfails in it.
Context:
Measurement tests are focused on legacy devices, but we should use the new device API for these tests.
Description of the Change:
Here's what I did, chronologically:
legacy
sub-folderdefault.qubit
(not DQL), changedefault.qubit
to point to DQ2, fix tests so they work with DQ2 (they all passed)default.qubit
to point to DQL, re-run non-legacy tests to see which ones fail, mark those as xfail (for now)legacy
folder that double-cover anything (in other words, any tests that didn't use DQL)Step 2 above involved some changes to PennyLane source code, and they are:
MutualInfoMP.map_wires
sampling.py
to not squeeze any CountsMP result (batched results also shouldn't be squeezed, but they are lists of dicts instead of just dicts)ProbabilityMP.marginal_prob
to just returnprob
ifself.wires
is None. This was commented out before, and I'm not sure why.Benefits:
qml.probs()
did not work with DQ2 before this little change D:Possible Drawbacks:
Slightly more tests. Think of this as effectively adding one more device to test with whenever doing device integration tests.
Follow-Up:
I made this story and mentioned the removal of xfails in it.