-
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
Raise a UserWarning
for a list of shots in Device.execute
#1659
Conversation
Codecov Report
@@ Coverage Diff @@
## v0.18.0-rc0 #1659 +/- ##
==============================================
Coverage ? 99.14%
==============================================
Files ? 197
Lines ? 14431
Branches ? 0
==============================================
Hits ? 14307
Misses ? 124
Partials ? 0 Continue to review full report at Codecov.
|
[ch7539] |
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! Works for PL-SF as well, so that's good!
pennylane/_device.py
Outdated
if self._shot_vector is not None: | ||
warnings.warn( | ||
"Specifying a list of shots is only supported for" | ||
"QubitDevice based devices. Falling back to executions using all shots in the shot list." | ||
) |
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.
Does this rely on QubitDevice never calling super().execute(...)
? Could be worth adding a comment about that, so that it's clear why this doesn't affect all devices.
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.
Good point! Yep, for QubitDevice
the execute
method differs significantly from Device.execute
. Let me add a comment.
Co-authored-by: Theodor <theodor@xanadu.ai>
* remove newlines in docstring (#1647) * Fix bug in single-qubit decomposition edge case. (#1643) * Fix bug in zyz decomposition and tidy tests. * Update CHANGELOG. * Tweak comments. * Raise an error for `qml.sample` and `shots=None` in `default.qubit.jax` (#1629) * deprecate qml.sample and shots=None for default.qubit.jax * changelog * formatting * move shot adaptive test * Streamline implementation and add matrix equivalence checks to tests. * Update single qubit op tests. Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: Josh Izaac <josh146@gmail.com> * Fix bug when using Jax jit and `QubitStateVector` (#1649) * Use numpy. * Separate torch case. * Update pennylane/devices/default_qubit.py Co-authored-by: antalszava <antalszava@gmail.com> * Matplotlib circuit drawing (#1484) * Raise a `UserWarning` for a list of shots in `Device.execute` (#1659) * add warning for shot list in pure Device based devices; test for default.gaussian * changelog * PR number * formatting * comment * Update pennylane/_device.py Co-authored-by: Theodor <theodor@xanadu.ai> * test message Co-authored-by: Theodor <theodor@xanadu.ai> * bugfix: raise mpl import error inside class initialization (#1667) * mpldrawer when mpl not installed * black * bugfix for device shot list processing (#1666) * fix process shots bug * add tests and changelog * docstrings and black * add frob to list (#1664) * Small change example. (#1669) * Adds PennyLane-Lightning as a dependency (#1663) * Add pl-lightning to requirements.txt and setup.py * Add to requirements-ci.txt * Temporarily add pybind11 * Update setup.py * Add setup.py * Add to changelog * update changelog * Update changelog * Remove from requirements * Does this fix? * Revert * New version * Add diff method * Add pennylane lightning pypi dep * Update changelog * Add simple test * Remove adjoint * Pin minimum version of lightning * Emphasize as lightning.qubit * Link to PL-Lightning release notes * Update .github/CHANGELOG.md * Update changelog Co-authored-by: Lee J. O'Riordan <loriordan@gmail.com> * tests/transforms/test_optimization/utils.py from rc * tests/transforms/test_decompositions.py from rc * Add shorter drawer example for the notes * Add Hamiltonian expval(H) plot * transforms test files * updated example image Co-authored-by: Theodor <theodor@xanadu.ai> Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com> Co-authored-by: Josh Izaac <josh146@gmail.com> Co-authored-by: Romain <rmoyard@gmail.com> Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Lee J. O'Riordan <loriordan@gmail.com>
* remove newlines in docstring (#1647) * Fix bug in single-qubit decomposition edge case. (#1643) * Fix bug in zyz decomposition and tidy tests. * Update CHANGELOG. * Tweak comments. * Raise an error for `qml.sample` and `shots=None` in `default.qubit.jax` (#1629) * deprecate qml.sample and shots=None for default.qubit.jax * changelog * formatting * move shot adaptive test * Streamline implementation and add matrix equivalence checks to tests. * Update single qubit op tests. Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: Josh Izaac <josh146@gmail.com> * Fix bug when using Jax jit and `QubitStateVector` (#1649) * Use numpy. * Separate torch case. * Update pennylane/devices/default_qubit.py Co-authored-by: antalszava <antalszava@gmail.com> * Matplotlib circuit drawing (#1484) * Raise a `UserWarning` for a list of shots in `Device.execute` (#1659) * add warning for shot list in pure Device based devices; test for default.gaussian * changelog * PR number * formatting * comment * Update pennylane/_device.py Co-authored-by: Theodor <theodor@xanadu.ai> * test message Co-authored-by: Theodor <theodor@xanadu.ai> * bugfix: raise mpl import error inside class initialization (#1667) * mpldrawer when mpl not installed * black * bugfix for device shot list processing (#1666) * fix process shots bug * add tests and changelog * docstrings and black * add frob to list (#1664) * Small change example. (#1669) * Adds PennyLane-Lightning as a dependency (#1663) * Add pl-lightning to requirements.txt and setup.py * Add to requirements-ci.txt * Temporarily add pybind11 * Update setup.py * Add setup.py * Add to changelog * update changelog * Update changelog * Remove from requirements * Does this fix? * Revert * New version * Add diff method * Add pennylane lightning pypi dep * Update changelog * Add simple test * Remove adjoint * Pin minimum version of lightning * Emphasize as lightning.qubit * Link to PL-Lightning release notes * Update .github/CHANGELOG.md * Update changelog Co-authored-by: Lee J. O'Riordan <loriordan@gmail.com> * Adjust Torch and TF backprop docstrings (#1662) * error * adjust TF docstring * Diff option backprop check rc (#1658) * update the condition for backprop diff * add test and readjust the other test * formatting * diff_method='parameter-shift' for default.tensor.tf * format tests * Update pennylane/qnode.py Co-authored-by: Romain <rmoyard@gmail.com> Co-authored-by: Romain <rmoyard@gmail.com> * V0.18.0 release notes (#1656) * version bump * group entries * update the descriptions * torch example * contributors * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * format lines * num * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * move q transforms * trainable coeffs * SISWAP adjust * Add link to changelog * Fix merge * SISWAP move to improvements * drawer example * remove item on separate requirements file * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * QFT move * further suggestions * NumPy * draw example * no grad call for finite_diff qml.gradients * no grad call for param_shift * lightning * Update .github/CHANGELOG.md Co-authored-by: Josh Izaac <josh146@gmail.com> * Hamiltonian + its plot * Hamiltonian param shift move * bug fix phrasing * contributors list * Lightning adjoint plot & description * Hamiltonian plot width * align mid * Revert "align mid" This reverts commit 9b8d354. Co-authored-by: Josh Izaac <josh146@gmail.com> Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Theodor <theodor@xanadu.ai> Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com> Co-authored-by: Josh Izaac <josh146@gmail.com> Co-authored-by: Romain <rmoyard@gmail.com> Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Lee J. O'Riordan <loriordan@gmail.com>
Adds a
UserWarning
to inform users that specifinyg the list of shots is only supported forQubitDevice
based devices. See related comment here and the original PR: #1103