forked from PennyLaneAI/pennylane
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test supported gradient kwargs and raise error for
shots
kwarg (Pen…
…nyLaneAI#5748) **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 of `QNode(..., shots=100)` not executing with `shots=100`. **Benefits:** Code quality, better user input validation. **Possible Drawbacks:** **Related GitHub Issues:** PennyLaneAI#5745 [sc-64175] --------- Co-authored-by: Pietropaolo Frisoni <[email protected]> Co-authored-by: Christina Lee <[email protected]>
- Loading branch information
1 parent
456e474
commit c14ce7b
Showing
6 changed files
with
83 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters