-
Notifications
You must be signed in to change notification settings - Fork 42
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
Lightning qubit2 supports shots #630
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 work, I left just a few comments.
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 @vincentmr
Just a few comments --- ignore anything that isn't sensible.
Co-authored-by: Amintor Dusko <[email protected]>
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.
Nice work on that!
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.
I didn't thoroughly review this PR.. just a few high-level questions/concerns while scrolling the support,
if circuit.shots.has_partitioned_shots: | ||
return tuple(res[0] for res in results) |
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.
when is it triggered?
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.
When one has something like dev = qml.device(name, shots=[10, 20, 30])
.
if len(circuit.measurements) == 1: | ||
return self.measurement(circuit.measurements[0]) | ||
|
||
return tuple(self.measurement(mp) for mp in circuit.measurements) |
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.
Isn't PL added support for PyTrees as return values? I'm concerned for users requested a non-tuple return value.
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.
Not sure, but I think the device's job is to bring the measurements in a format that the QNode can handle, and the QNode does the final reshaping, casting, etc.
mcmc: bool = None, | ||
kernel_name: str = None, | ||
num_burnin: int = None, |
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.
We could use a data-class encapsulate all MCMC options in the whole pipeline.
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.
We don't use those, but we could. Good idea.
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
tests
directory!All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs
.Ensure that the test suite passes, by running
make test
.Add a new entry to the
.github/CHANGELOG.md
file, summarizing thechange, and including a link back to the PR.
Ensure that code is properly formatted by running
make format
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
The new LQ device must support shots.
Description of the Change:
Add shots support in LQ2.
Add shots tests in test_measurements.py.
Fix bugs uncovered in LQ by new shots tests.
Benefits:
Possible Drawbacks:
Related GitHub Issues: