-
Notifications
You must be signed in to change notification settings - Fork 630
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
Fix cases for qml.sample(..., counts=True)
#2839
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2839 +/- ##
========================================
Coverage 99.63% 99.63%
========================================
Files 251 252 +1
Lines 20572 20757 +185
========================================
+ Hits 20496 20681 +185
Misses 76 76
Continue to review full report at Codecov.
|
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.
Great changes @antalszava, I am glad that it is working as expected 💯 I've left some comments. One thing that is out of scope of this PR is that I would find great that we always return the dictionary for every state:
{'001': 7, '111': 3} could become {'000': 0, 001': 7, '010': 0, '011': 0, '100': 0, '101': 0, '110': 0 '111': 3}
@rmoyard thanks for the comments!
Good point! Could it be user-dependent, i.e., some prefer this some prefer that? Would it be worth having kwarg for it? |
That could be done with |
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.
Left some minor, optional potential improvements.
Excellent job getting this to work!
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
… approach pops items on first use
[sc-23475] |
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 @antalszava, it looks good on my side 💯
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 go from my side.
Created an issue for returning or states with counts: From my side, I'm still wondering about the refactor to the |
Context:
In a recent PR it was found that the
qml.shots(..., counts=True)
behaves in unexpected ways in some cases. The original addition was made in this PR.Description of the Change:
Fixed the use of returning counts when:
Note that counts now no longer return tensor objects, but rather raw dictionaries or sequences that contain dictionaries.
Benefits:
Returning counts works in more cases as expected.
Possible Drawbacks:
N/A
Related GitHub Issues:
N/A