-
Notifications
You must be signed in to change notification settings - Fork 29
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
[Frontend] A prototype for one_shot_dynamic transform #734
Conversation
where `m` is a measurement result.
qreg_in = qreg_out | ||
# (1.5) If user wanted the `dynamic_one_shot` transformation we apply it by re-tracing the | ||
# function using the wrapper loop. | ||
if qnode.needs_dynamic_one_shot and device.shots.total_shots != 1: |
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.
dynamic_one_shot
may also be applied to a single shot tape, but we can neglect that case at first I would say.
Hello. You may have forgotten to update the changelog!
|
@for_loop(0, orig_shots, 1) | ||
def loop(i, s): | ||
r = f(*args2, **kwargs2) | ||
s = s.at[i].set(r) |
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.
It appears r
comes out as a quantum measurements (e.g. qml.expval
) instead of the results (e.g. 0.0
) which throws off the rest of the tracing. Is it just me?
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.
Hmm, I did not pay attention to this. My idea is that it might be a correct resulting tracer of some kind. In the example I used catalyst.measure (returning a boolean tracer) but I hoped that measurements would just return a measurement tracer. The thing is - we do not know its value at the compile time.
superseded by #773 |
[sc-63049]
See also an internal document regarding this issue.