-
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
fix and enable pulse gradient with broadcasting on new device #4620
Merged
Conversation
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
timmysilv
commented
Sep 20, 2023
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4620 +/- ##
=======================================
Coverage 99.62% 99.62%
=======================================
Files 375 375
Lines 33486 33486
=======================================
+ Hits 33361 33362 +1
+ Misses 125 124 -1
☔ View full report in Codecov by Sentry. |
mudit2812
approved these changes
Sep 21, 2023
albi3ro
approved these changes
Sep 21, 2023
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.
👍
mudit2812
pushed a commit
that referenced
this pull request
Sep 22, 2023
**Context:** Enabling this was missed in the DQ2 switch-over. We originally said that `ParametrizedEvolution` should fail to apply to broadcasted states, but `pulse_generator` and `stoch_pulse_grad` have custom handling for certain cases, so we ought not be so decisive in `apply_operation`. That said, if the inputted state is batched but the operator is not, then we're in trouble. **Description of the Change:** - Only raise the batched-state-ParametrizedEvolution error when the op is not itself batched - put shots on tapes created by `pulse_generator` (missed in gradient uses tape shots upgrade) - change `test_jax` at the bottom of each gradient test file to use `"backprop"` instead of `None` for the `gradient_fn`. This worked as-is on `DefaultQubitJax` because it has a [passthru_interface set](https://github.com/PennyLaneAI/pennylane/blob/e909e56a197cbdea772449e972a12da4931cf2b8/pennylane/interfaces/execution.py#L581), but really it's using backprop. Maybe that boolean needs more work, but this seemed like a niche-enough test case, so I fixed the test instead of the code. **Benefits:** pulse gradients work with the new device and `use_broadcasting=True`!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context:
Enabling this was missed in the DQ2 switch-over. We originally said that
ParametrizedEvolution
should fail to apply to broadcasted states, butpulse_generator
andstoch_pulse_grad
have custom handling for certain cases, so we ought not be so decisive inapply_operation
. That said, if the inputted state is batched but the operator is not, then we're in trouble.Description of the Change:
pulse_generator
(missed in gradient uses tape shots upgrade)test_jax
at the bottom of each gradient test file to use"backprop"
instead ofNone
for thegradient_fn
. This worked as-is onDefaultQubitJax
because it has a passthru_interface set, but really it's using backprop. Maybe that boolean needs more work, but this seemed like a niche-enough test case, so I fixed the test instead of the code.Benefits:
pulse gradients work with the new device and
use_broadcasting=True
!