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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jax jit qnode integration with DefaultQubit2 #4352
Merged
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
Codecov Report
@@ Coverage Diff @@
## master #4352 +/- ##
=======================================
Coverage 99.77% 99.77%
=======================================
Files 351 351
Lines 32143 32150 +7
=======================================
+ Hits 32070 32077 +7
Misses 73 73
|
timmysilv
commented
Jul 12, 2023
albi3ro
reviewed
Jul 12, 2023
eddddddy
reviewed
Jul 14, 2023
eddddddy
approved these changes
Jul 17, 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.
Looks good 馃挴
albi3ro
approved these changes
Jul 17, 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.
Looks great ! 馃憤
mudit2812
pushed a commit
that referenced
this pull request
Jul 18, 2023
* copy-paste jax-jit file * replace old dev with new one * make tests pass for jax-jit * changelog; fix copyright year * black * Update doc/releases/changelog-dev.md * convert to tuple everywhere in jax * fix pesky test * also pass is_state_batched to finite shot case * add more detailed comment to tape.shape change
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:
All interfaces should work with the new device, and that includes jax-jit!
Description of the Change:
Add jax-jit QNode support. This involved a few little things:
is_state_batched
arg when callingmeasure
, so I fixed thatshape_dtype
thing is a weird thing that I can't explain easily in words, but I will give the low-down. The helper function that generates shape objects says "if only 1 measurement and only 1 tape, returnshapes[0]
", but the function that interpreted it assumed that it was always a list of shape objects. This was only found because a) the new devices does some pre-processing for adjoint differentiation (including settingtape.trainable_parameters
) but wrongly - see [BUG]validate_and_expand_adjoint
does not handle new parameters correctly聽#4351.QuantumScript.shape
to support the new device interface. Basically,device
won't provide anything we need, butself
(a tape) will! It shouldn't be a dangerous change because jax-jit is the only place that usesQuantumScript.shape
afaik (pls correct me if I'm wrong)Benefits:
jax-jit works with QNodes and DefaultQubit2
Possible Drawbacks:
Changes 2-4 from above all seem to suggest some cleanup could be necessary for various parts of our code (
tape.shape
, jax_jit_tuple.py in general)[sc-41087]