-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix and enable pulse gradient with broadcasting on new device (#4620)
**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`!
- Loading branch information
Showing
6 changed files
with
39 additions
and
26 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