-
Notifications
You must be signed in to change notification settings - Fork 617
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
Implement process_counts in ExpectationMP, VarianceMP and CountsMP #5256
Implement process_counts in ExpectationMP, VarianceMP and CountsMP #5256
Conversation
Moved the logic of mapping counts from ProbabilityMP to CountsMP
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5256 +/- ##
==========================================
- Coverage 99.64% 99.63% -0.01%
==========================================
Files 401 401
Lines 37215 36963 -252
==========================================
- Hits 37082 36829 -253
- Misses 133 134 +1 ☔ View full report in Codecov by Sentry. |
Renaming counts argument doesn't help new pylint error `arguments-renamed` occurs.
I am not sure how to fix failing CI check, Can the reviewers please guide me? |
Thanks a lot for opening this @Tarun-Kumar07! We'll give this a review soon and also help with the CI issue you mentioned. Sorry if things are a little delayed this week, we're busy preparing for the PennyLane 0.35 release next week 🚀 |
@trbromley Thank you for your response. |
hi @Tarun-Kumar07 , thanks for bearing with us! I've pushed a fix for the strange "Documentation Check" issue to the master branch. If you update your fork with the latest master, it should disappear 🤞 give it a try, I'll keep an eye out to make sure it's resolved here. |
# Conflicts: # doc/releases/changelog-dev.md
@timmysilv all CI checks passed 🎉 , thanks for the fix. |
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.
Sorry about the delay in review.
This is looking really great @Tarun-Kumar07 :)
I only have two main requests:
- stripping out zeros entries if
all_outcomes=False
- Using
qml.QueuingManager.stop_recording()
around any location that creates an intermediary measurement process
But once those are done, I'll be happy to approve.
Hey @albi3ro, I noticed that all classes which inherit from SampleMeasurement implement process_counts except SampleMP. Should I add an implementation for that? |
db6f2d5
to
dada914
Compare
dada914
to
fb5f96e
Compare
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.
Just left a request to change the changelog entry to reference this PR, rather than the issues.
Looking great to me 🎉
Yes, we could also use SampleMP.process_counts
, but we could potentially stick that into an independent PR instead.
Co-authored-by: Christina Lee <[email protected]>
Hi @albi3ro and @trbromley, Thanks for reviewing my PR. Appreciate it! |
@albi3ro, regarding adding |
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! 🎸
I'll go ahead and create an issue right now. Since this PR now has two approvals 🎉 , I'll go ahead and enable auto-merge. Congrats on the PR! |
Thanks @Tarun-Kumar07! Great job with this PR. We often tag contributors in our release marketing on Twitter/X (this will happen at the start of May). If you would optionally like to be tagged, please could you share your username? |
Context:
Under #4941 abstract method
process_counts
was added toSampleMeasurement
. This method provides support to process counts dictionary produced by external systems.Description of the Change:
process_counts
inExpectationMP
,VarianceMP
andCountsMP
.process_counts
inCountsMP
some common logic was extracted fromProbabilityMP
toCountsMP
Benefits:
The below methods won't throw
NotImplementedError
exceptionExpectationMP.process_counts
VarianceMP.process_counts
CountsMP.process_counts
Possible Drawbacks:
SampleMeasurement
implementprocess_counts
exceptSampleMP
.Should I add an implementation for that ?
process_counts
in all child classes can we make the method abstract similar toprocess_samples
? This might break some tests where some classes inherit fromSampleMeasurement
as thereprocess_counts
is not implementedcounts
dictionary is valid and caller is responsible to call with valid dictionary. It has already been discussed in this conversation and this is a design choice.Related GitHub Issues:
This PR
CountsMP.process_counts
#5249VarianceMP.process_counts
#5244ExpectationMP.process_counts
#5241Further details
I'm excited to be making my first open-source contribution with this PR 😄 .
As a newcomer to the community, I'm eager to learn and improve.
Any feedback for enhancements would be greatly appreciated!
Internal Shortcut Stories