-
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
Use SampleMPs in dynamic_one_shot #5486
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5486 +/- ##
==========================================
+ Coverage 99.67% 99.68% +0.01%
==========================================
Files 407 409 +2
Lines 38019 37907 -112
==========================================
- Hits 37895 37789 -106
+ Misses 124 118 -6 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Christina Lee <christina@xanadu.ai>
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.
All the source code looks good to me.
I'm surprised no tests failed with this change. Could we perhaps add some more unit tests to tests/transforms/test_dynamic_one_shot.py
to assert the output batch when applied to a tape looks correct?
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.
Looks good to me. Approving since the only thing I can see that needs to be changed is the additional tests Christina suggested.
Thanks @mudit2812 . I added some tests in |
The added tests seem sound to me. Could you also add a test to check the correctness for broadcasted tapes? The number of tapes in that case should be |
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 🚀 !
**Context:** `_validate_computational_basis_sampling` takes tape as input since PennyLaneAI/pennylane#5486 **Description of the Change:** The argument is now the tape instead of the list of measurements
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:
The native MCM workflow breaks the device API where a sequence of MeasurementProcess objects is expected in the output.
Description of the Change:
Introduce SampleMPs in the auxiliary tape. Pass the mid_measurements dictionary around simulate and sampling to return the correct sample measurements. Modify the dynamic_one_shot transform post-processing function accordingly.
Benefits:
Conform to current API.
Road to jax.jit support.
Possible Drawbacks:
Ad hoc post-processing required in measure_with_samples.
Related GitHub Issues:
[sc-60945]