-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Partial support of reset gate in cirq_google protos #7095
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
Changes from 7 commits
767ba19
9b9a7cc
5a0c2d6
9ed2e91
7a8cb6f
76720c5
4c09b54
ff0c75c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,6 +237,8 @@ def _serialize_gate_op( | |
| arg_func_langs.float_arg_to_proto( | ||
| gate.duration.total_nanos(), out=msg.waitgate.duration_nanos | ||
| ) | ||
| elif isinstance(gate, cirq.ResetChannel): | ||
| arg_func_langs.arg_to_proto(gate.dimension, out=msg.resetgate.arguments['dimension']) | ||
| elif isinstance(gate, CouplerPulse): | ||
| arg_func_langs.float_arg_to_proto( | ||
| gate.hold_time.total_picos(), out=msg.couplerpulsegate.hold_time_ps | ||
|
|
@@ -648,6 +650,14 @@ def _deserialize_gate_op( | |
| operation_proto.waitgate.duration_nanos, required_arg_name=None | ||
| ) | ||
| op = cirq.WaitGate(duration=cirq.Duration(nanos=total_nanos or 0.0))(*qubits) | ||
| elif which_gate_type == 'resetgate': | ||
| dimensions = arg_func_langs.arg_from_proto( | ||
| operation_proto.resetgate.arguments.get('dimension', 2) | ||
| ) | ||
| assert isinstance( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: prefer not to use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| dimensions, int | ||
| ), f"dimensions {dimensions} for ResetChannel must be an integer!" | ||
| op = cirq.ResetChannel(dimension=dimensions)(*qubits) | ||
| elif which_gate_type == 'internalgate': | ||
| op = arg_func_langs.internal_gate_from_proto(operation_proto.internalgate)(*qubits) | ||
| elif which_gate_type == 'couplerpulsegate': | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.