-
Notifications
You must be signed in to change notification settings - Fork 586
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
clarify that qnodes with qml.sample are not differentiable #5237
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5237 +/- ##
==========================================
- Coverage 99.68% 99.67% -0.01%
==========================================
Files 399 399
Lines 36853 36567 -286
==========================================
- Hits 36736 36449 -287
- Misses 117 118 +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.
Thanks @timmysilv!
Although it is possible with autograd, should we at least raise a warning saying that what the user is trying to do doesn't necessarily make sense? |
the trouble with all this is that auto-diff can be rather opaque. we don't generally have the QuantumScripts available to us ahead of time, so we can't inspect the measurements in order to know when to raise the warning. an alternative way to think about this is, QNodes won't know that they're being executed within a |
Context:
Autograd allows the differentiation of integers, although this doesn't entirely make sense (see #2556). On top of this, our docstring for
qml.sample
currently suggests that it is possible, when it should really just point the user elsewhere.Description of the Change:
qml.sample
to suggest the use of expval insteadBenefits:
More useful docs
Possible Drawbacks:
We are testing something that shouldn't exist just because Autograd said it should exist
Related GitHub Issues:
Fixes #4840