-
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
Test supported gradient kwargs and raise error for shots
kwarg
#5748
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5748 +/- ##
==========================================
- Coverage 99.67% 99.66% -0.01%
==========================================
Files 414 414
Lines 39314 39023 -291
==========================================
- Hits 39185 38893 -292
- Misses 129 130 +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.
🎉 Looks good :)
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 @dwierichs ! Looks amazing. Just a couple of minor comments, but no blockers from me 👍
Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@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.
Amazing! Thanks again @dwierichs
Context:
Additional kwargs passed to a QNode at initialization are interpreted as gradient kwargs.
They are checked against the hardcoded collection
qml.gradients.SUPPORTED_GRADIENT_KWARGS
to make sure that this boilerplate interpretation of additional kwargs makes sense.Description of the Change:
This PR adds a test that makes sure that
qml.gradients.SUPPORTED_GRADIENT_KWARGS
actually matches all gradient transform kwargs supported by PL.In addition, this PR introduces an error being raised when the keyword argument
shots
is passed at QNode initialization, because this is not a valid gradient kwarg and even if it were, it would lead to the confusing behaviour ofQNode(..., shots=100)
not executing withshots=100
.Benefits:
Code quality, better user input validation.
Possible Drawbacks:
Related GitHub Issues:
#5745
[sc-64175]