-
Notifications
You must be signed in to change notification settings - Fork 989
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
Add ZerosSampler #2912
Add ZerosSampler #2912
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.
This looks good.
- Could you add the
async
sampler methods as well? not blocking but I personally use these methods in my workflows - Right now this can be used for a simple check that there are no glaring errors in one's experimental workflow. This could be hugely more useful if it could also validate that you're using supported gates and extant qubits. Unfortunately, right now the gateset validation logic is trapped inside the Quantum Engine serialization routines, but I encourage you to think about how to incorporate gateset validation into ZerosSampler
|
||
def test_sample(): | ||
# Create a circuit whose measurements are always zeros, and check that | ||
# results of ZeroSampler on this circuit are identical to results of |
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.
👍
Hi Matthew,
|
1: ok good |
Hi @mpharrigan, Regarding extand qubits: there is a class cirq.devices.Device, which has method qubit_set. So we could pass the device to a constructor (like I did with gate set) and in run_sweep() get all qubits referenced by a device, and check that they are all in this qubit_set. |
Question to @mpharrigan : shouldn't the device and gateset validation be handled by setting an appropriate device on the circuit? What is the primary use case for this class, is it to do this validation? Then maybe it should be called something slightly different? |
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.
A couple of drive by comments.
… zeros-sampler
Can we merge this? |
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.
LGTM
Automerge cancelled: A required status check is not present. Missing statuses: ['cla/google'] |
Automerge cancelled: A required status check is not present. Missing statuses: ['cla/google'] |
@googlebot please rescan |
A dummy sampler which implements
cirq.Sampler
and returns zeroes for all measurements.Fixes #2818