-
Notifications
You must be signed in to change notification settings - Fork 575
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
Error when creating qnode with backprop and finite-shots #1588
Merged
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a9b1802
bugfix: warn when backprop with finite-shots
albi3ro cbeec00
add changelog
albi3ro 0fb8049
Merge branch 'master' into backprop_finite_shots
antalszava 03d8eef
Merge branch 'master' into backprop_finite_shots
albi3ro bfd9c24
get tests to pass, black
albi3ro acb5204
Merge branch 'backprop_finite_shots' of https://github.com/PennyLaneA…
albi3ro ef4f6c8
black
albi3ro 77ff97c
Apply suggestions from code review
albi3ro 9bcc23b
test over interfaces
albi3ro df8dc99
Merge branch 'master' into backprop_finite_shots
albi3ro 1e40567
Merge branch 'master' into backprop_finite_shots
albi3ro 0cd9744
Merge branch 'master' into backprop_finite_shots
albi3ro c6fc3aa
Merge branch 'master' into backprop_finite_shots
albi3ro f39eeef
Merge branch 'master' into backprop_finite_shots
albi3ro 9d860ed
black
albi3ro 6b5c677
use diff_method=None in tests
albi3ro a274a5d
Merge branch 'master' into backprop_finite_shots
albi3ro 2c95ad5
black
albi3ro 6f8e0df
Merge branch 'backprop_finite_shots' of https://github.com/PennyLaneA…
albi3ro 959bbbb
remove unnecessary test
albi3ro 51593a6
Update tests/devices/test_default_qubit_jax.py
albi3ro 5f3eee2
Merge branch 'master' into backprop_finite_shots
albi3ro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,15 @@ def test_validate_device_method(self, monkeypatch): | |
assert interface == "interface" | ||
assert device is dev | ||
|
||
@pytest.mark.parametrize("interface", ("autograd", "torch", "tensorflow", "jax")) | ||
def test_validate_backprop_method_finite_shots(self, interface): | ||
"""Tests that an error is raised for backpropagation with finite shots.""" | ||
|
||
dev = qml.device("default.qubit", wires=1, shots=3) | ||
|
||
with pytest.raises(qml.QuantumFunctionError, match="Devices with finite shots"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice test 💯 |
||
QNode._validate_backprop_method(dev, interface) | ||
|
||
def test_validate_backprop_method_invalid_device(self): | ||
"""Test that the method for validating the backprop diff method | ||
tape raises an exception if the device does not support backprop.""" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 👍