-
Notifications
You must be signed in to change notification settings - Fork 1k
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
DeviceMetadata docs update. #4963
DeviceMetadata docs update. #4963
Conversation
def qubit_set(self) -> FrozenSet['cirq.Qid']: | ||
"""Returns a set of qubits on the device, if possible. | ||
"""Returns the set of qubits on the device. |
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.
So objects like _UnconstrainedDevice
would no longer be possible to write?
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 can still have the UnconstrainedDevice as it exists today. We just won't be able to add the metadata
property to it because it doesn't have any qubits or nx_graph.
if working_gatefamilies != gateset.gates: | ||
missing_items = working_gatefamilies.difference(gateset.gates) | ||
raise ValueError( | ||
"Supplied gate_durations contains gates not present" | ||
f" in supported_gates. {missing_items} in supported_gates" | ||
f" in gateset. {missing_items} in gateset" | ||
" is False." | ||
) |
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 are checking for equality but reporting difference in the ValueError. It's possible that working_gatefamilies is a subset of gateset.gates, in which case missing_items
will be an empty set and error message would not be useful.
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 % nits.
"Supplied gate_durations contains gates not present" | ||
" in gateset." |
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.
nit: This is still not correct, because if gate_durations
is a subset of gateset, it won't contain any gates not present in the gateset, but vice versa would be true.
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.
Updated wording here to reflect the fact we are doing strict equality checks.
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.
gate_durations.keys
should be allowed to be a subset of the gateset, because a gateset could contain GateFamilies that don't represent actual gates, such as FSimGateFamily
.
An alternative Gateset
design is to separate out GateFamilies like FSimGateFamily
into a separate property equivalence_gate_families
, which are used somewhat differently compared to GateFamilies representing gates.
… of gateset (#5309) Fix for #4963 (comment) In the current Gateset design, some GateFamilies in a Gateset may not correspond to an actual device gate (e.g. `cirq_google.FSimGateFamily`). The new `GridDevice` implementation includes `FSimGateFamily` in its gateset to accept all equivalent Cirq representations of valid 2-qubit gates. @MichaelBroughton cc @tanujkhattar
… of gateset (quantumlib#5309) Fix for quantumlib#4963 (comment) In the current Gateset design, some GateFamilies in a Gateset may not correspond to an actual device gate (e.g. `cirq_google.FSimGateFamily`). The new `GridDevice` implementation includes `FSimGateFamily` in its gateset to accept all equivalent Cirq representations of valid 2-qubit gates. @MichaelBroughton cc @tanujkhattar
… of gateset (quantumlib#5309) Fix for quantumlib#4963 (comment) In the current Gateset design, some GateFamilies in a Gateset may not correspond to an actual device gate (e.g. `cirq_google.FSimGateFamily`). The new `GridDevice` implementation includes `FSimGateFamily` in its gateset to accept all equivalent Cirq representations of valid 2-qubit gates. @MichaelBroughton cc @tanujkhattar
Closes #4962