-
Notifications
You must be signed in to change notification settings - Fork 627
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
[Return-types #5.3] Param-shift shot vector case #3099
Conversation
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 job @antalszava, it is looking good 💯 I have some comments and questions. It might be worth to create a smalll separate test class with all the cases we know where you parametrize the number of parameters, number of measurements and different shot vectors like we did for backprop previously.
my above comments are all pretty small, this PR looks great! updating that test file was a true feat 😸 |
Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
…/pennylane into param_shift_shot_vec_new_ret
@timmysilv @rmoyard thanks for the great comments! 🎉 I think I've addressed them all, some with questions - keen to get further thoughts. 👍 Let me know what should definitely change still in this PR. |
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.
🥳
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 job @antalszava 🥇 We might be missing one test case. If it is not the case I will be happy to approve the PR!
…/pennylane into param_shift_shot_vec_new_ret
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 it looks great 💯
Context:
Follows the previous PRs on Return-types to allow the
param_shift
gradient transform to process results when the gradient tapes are executed on a device that has a shot vector defined.Description of the Change:
shots
parameter to theparam_shift
,expval_param_shift
andvar_param_shift
functions including the new return type versions of these functions and auxiliary functions that may require information about shots;param_shift
to handle executing gradient tapes on a device with a shot vector;tests/returntypes/test_parameter_shift_new.py
(Hamiltonian tests being left as TODO).Benefits:
Most cases work for execution using shot vectors.
Possible Drawbacks:
The logic that attempts to determine if the user didn't pass the
shots
argument, but execution happened with a shot vector device. To do this,ValueError
s raised are being caught - the user sees a message related to setting theshots
argument along the original error message.Related GitHub Issues:
[sc-27498]