-
Notifications
You must be signed in to change notification settings - Fork 603
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
BugFix: TorchLayer now supports shot batching #5492
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5492 +/- ##
========================================
Coverage 99.67% 99.67%
========================================
Files 407 409 +2
Lines 38019 37867 -152
========================================
- Hits 37895 37745 -150
+ Misses 124 122 -2 ☔ View full report in Codecov by Sentry. |
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 @astralcai !
Mostly looks good to me.
Before approving, we should figure out what is going on in finite diff and SPSA with the permuted axes.
Also I had a question on a missing usefixtures
that does not seem to affect the test passing. Am I confused about how this works? 😅
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.
Left a couple of initial comments. Seems to me that this is currently blocked by the expected shape of the returns.
@dwierichs Can you elaborate? |
@astralcai I was just referring to the output shape question for these gradient methods. |
This only happens when the measurements are in a list. If you change the list to a tuple, the error does not appear, which is the case for most tests out there. More specifically, this only occurs when you have a list of only one measurement returned from a |
Ahh, I understand now, thank you! 🙏 Sorry, I overlooked that distinction. I still think we should test a forward-pass output shape not only within differentiation tests :) Would you mind adding a tiny test for this? If the code is ever changed, it would be confusing not to have any forward pass tests fail, but two differentation tests. |
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 @astralcai 🎉
Just small suggestions to wrap up, but looks good to me!
Context:
TorchLayer
raises an error when used with a shot vector.Description of the Change:
TorchLayer
_to_qfunc_output_type
inqnode.py
that turns the entire shot-batched output, as opposed to each output in the batch, into the qfunc output type.Related GitHub Issues:
Fixes #5319
[sc-58099]