From c816eccefa7f7b37dbdc7347a080a75f374582b9 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 10:31:49 -0800 Subject: [PATCH 01/13] Support TUnits in circuit serialization --- cirq-google/cirq_google/api/v2/program.proto | 5 + cirq-google/cirq_google/api/v2/program_pb2.py | 191 +++++++++--------- .../cirq_google/api/v2/program_pb2.pyi | 11 +- .../serialization/arg_func_langs.py | 11 +- .../serialization/arg_func_langs_test.py | 12 ++ .../serialization/circuit_serializer_test.py | 12 ++ dev_tools/build-protos.sh | 4 +- dev_tools/requirements/deps/protos.txt | 2 + 8 files changed, 147 insertions(+), 101 deletions(-) diff --git a/cirq-google/cirq_google/api/v2/program.proto b/cirq-google/cirq_google/api/v2/program.proto index f493fdcca4f..140a8ca0236 100644 --- a/cirq-google/cirq_google/api/v2/program.proto +++ b/cirq-google/cirq_google/api/v2/program.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +import "tunits/proto/tunits.proto"; + package cirq.google.api.v2; option java_package = "com.google.cirq.google.api.v2"; @@ -77,6 +79,8 @@ message Moment { repeated CircuitOperation circuit_operations = 2; } + + // The quantum circuit, specified as a series of operations at specific // start times. message Schedule { @@ -296,6 +300,7 @@ message ArgValue { RepeatedInt64 int64_values = 5; RepeatedDouble double_values = 6; RepeatedString string_values = 7; + tunits.Value value_with_unit = 8; } } diff --git a/cirq-google/cirq_google/api/v2/program_pb2.py b/cirq-google/cirq_google/api/v2/program_pb2.py index fac95fb478c..fe4e7dfbe52 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.py +++ b/cirq-google/cirq_google/api/v2/program_pb2.py @@ -11,9 +11,10 @@ _sym_db = _symbol_database.Default() +from tunits.proto import tunits_pb2 as tunits_dot_proto_dot_tunits__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xa7\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xcf\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xa7\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xf9\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -31,98 +32,98 @@ _OPERATION.fields_by_name['args']._serialized_options = b'\030\001' _INTERNALGATE_GATEARGSENTRY._options = None _INTERNALGATE_GATEARGSENTRY._serialized_options = b'8\001' - _globals['_PROGRAM']._serialized_start=57 - _globals['_PROGRAM']._serialized_end=272 - _globals['_CONSTANT']._serialized_start=275 - _globals['_CONSTANT']._serialized_end=422 - _globals['_CIRCUIT']._serialized_start=425 - _globals['_CIRCUIT']._serialized_end=637 - _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_start=558 - _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_end=637 - _globals['_MOMENT']._serialized_start=639 - _globals['_MOMENT']._serialized_end=764 - _globals['_SCHEDULE']._serialized_start=766 - _globals['_SCHEDULE']._serialized_end=846 - _globals['_SCHEDULEDOPERATION']._serialized_start=848 - _globals['_SCHEDULEDOPERATION']._serialized_end=944 - _globals['_LANGUAGE']._serialized_start=946 - _globals['_LANGUAGE']._serialized_end=1009 - _globals['_FLOATARG']._serialized_start=1011 - _globals['_FLOATARG']._serialized_end=1118 - _globals['_XPOWGATE']._serialized_start=1120 - _globals['_XPOWGATE']._serialized_end=1178 - _globals['_YPOWGATE']._serialized_start=1180 - _globals['_YPOWGATE']._serialized_end=1238 - _globals['_ZPOWGATE']._serialized_start=1240 - _globals['_ZPOWGATE']._serialized_end=1321 - _globals['_PHASEDXPOWGATE']._serialized_start=1323 - _globals['_PHASEDXPOWGATE']._serialized_end=1441 - _globals['_PHASEDXZGATE']._serialized_start=1444 - _globals['_PHASEDXZGATE']._serialized_end=1617 - _globals['_CZPOWGATE']._serialized_start=1619 - _globals['_CZPOWGATE']._serialized_end=1678 - _globals['_FSIMGATE']._serialized_start=1680 - _globals['_FSIMGATE']._serialized_end=1807 - _globals['_ISWAPPOWGATE']._serialized_start=1809 - _globals['_ISWAPPOWGATE']._serialized_end=1871 - _globals['_MEASUREMENTGATE']._serialized_start=1873 - _globals['_MEASUREMENTGATE']._serialized_end=1974 - _globals['_WAITGATE']._serialized_start=1976 - _globals['_WAITGATE']._serialized_end=2040 - _globals['_OPERATION']._serialized_start=2043 - _globals['_OPERATION']._serialized_end=3234 - _globals['_OPERATION_ARGSENTRY']._serialized_start=3143 - _globals['_OPERATION_ARGSENTRY']._serialized_end=3211 - _globals['_GATE']._serialized_start=3236 - _globals['_GATE']._serialized_end=3254 - _globals['_QUBIT']._serialized_start=3256 - _globals['_QUBIT']._serialized_end=3275 - _globals['_ARG']._serialized_start=3278 - _globals['_ARG']._serialized_end=3434 - _globals['_ARGVALUE']._serialized_start=3437 - _globals['_ARGVALUE']._serialized_end=3772 - _globals['_REPEATEDINT64']._serialized_start=3774 - _globals['_REPEATEDINT64']._serialized_end=3805 - _globals['_REPEATEDDOUBLE']._serialized_start=3807 - _globals['_REPEATEDDOUBLE']._serialized_end=3839 - _globals['_REPEATEDSTRING']._serialized_start=3841 - _globals['_REPEATEDSTRING']._serialized_end=3873 - _globals['_REPEATEDBOOLEAN']._serialized_start=3875 - _globals['_REPEATEDBOOLEAN']._serialized_end=3908 - _globals['_ARGFUNCTION']._serialized_start=3910 - _globals['_ARGFUNCTION']._serialized_end=3976 - _globals['_CIRCUITOPERATION']._serialized_start=3979 - _globals['_CIRCUITOPERATION']._serialized_end=4282 - _globals['_REPETITIONSPECIFICATION']._serialized_start=4285 - _globals['_REPETITIONSPECIFICATION']._serialized_end=4473 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4425 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4453 - _globals['_QUBITMAPPING']._serialized_start=4476 - _globals['_QUBITMAPPING']._serialized_end=4648 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4554 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4648 - _globals['_MEASUREMENTKEY']._serialized_start=4650 - _globals['_MEASUREMENTKEY']._serialized_end=4686 - _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4689 - _globals['_MEASUREMENTKEYMAPPING']._serialized_end=4915 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=4794 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=4915 - _globals['_ARGMAPPING']._serialized_start=4918 - _globals['_ARGMAPPING']._serialized_end=5078 - _globals['_ARGMAPPING_ARGENTRY']._serialized_start=4990 - _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5078 - _globals['_INTERNALGATE']._serialized_start=5081 - _globals['_INTERNALGATE']._serialized_end=5286 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5214 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5286 - _globals['_COUPLERPULSEGATE']._serialized_start=5289 - _globals['_COUPLERPULSEGATE']._serialized_end=5761 - _globals['_CLIFFORDTABLEAU']._serialized_start=5764 - _globals['_CLIFFORDTABLEAU']._serialized_end=5903 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=5905 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=5984 - _globals['_IDENTITYGATE']._serialized_start=5986 - _globals['_IDENTITYGATE']._serialized_end=6019 - _globals['_HPOWGATE']._serialized_start=6021 - _globals['_HPOWGATE']._serialized_end=6079 + _globals['_PROGRAM']._serialized_start=84 + _globals['_PROGRAM']._serialized_end=299 + _globals['_CONSTANT']._serialized_start=302 + _globals['_CONSTANT']._serialized_end=449 + _globals['_CIRCUIT']._serialized_start=452 + _globals['_CIRCUIT']._serialized_end=664 + _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_start=585 + _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_end=664 + _globals['_MOMENT']._serialized_start=666 + _globals['_MOMENT']._serialized_end=791 + _globals['_SCHEDULE']._serialized_start=793 + _globals['_SCHEDULE']._serialized_end=873 + _globals['_SCHEDULEDOPERATION']._serialized_start=875 + _globals['_SCHEDULEDOPERATION']._serialized_end=971 + _globals['_LANGUAGE']._serialized_start=973 + _globals['_LANGUAGE']._serialized_end=1036 + _globals['_FLOATARG']._serialized_start=1038 + _globals['_FLOATARG']._serialized_end=1145 + _globals['_XPOWGATE']._serialized_start=1147 + _globals['_XPOWGATE']._serialized_end=1205 + _globals['_YPOWGATE']._serialized_start=1207 + _globals['_YPOWGATE']._serialized_end=1265 + _globals['_ZPOWGATE']._serialized_start=1267 + _globals['_ZPOWGATE']._serialized_end=1348 + _globals['_PHASEDXPOWGATE']._serialized_start=1350 + _globals['_PHASEDXPOWGATE']._serialized_end=1468 + _globals['_PHASEDXZGATE']._serialized_start=1471 + _globals['_PHASEDXZGATE']._serialized_end=1644 + _globals['_CZPOWGATE']._serialized_start=1646 + _globals['_CZPOWGATE']._serialized_end=1705 + _globals['_FSIMGATE']._serialized_start=1707 + _globals['_FSIMGATE']._serialized_end=1834 + _globals['_ISWAPPOWGATE']._serialized_start=1836 + _globals['_ISWAPPOWGATE']._serialized_end=1898 + _globals['_MEASUREMENTGATE']._serialized_start=1900 + _globals['_MEASUREMENTGATE']._serialized_end=2001 + _globals['_WAITGATE']._serialized_start=2003 + _globals['_WAITGATE']._serialized_end=2067 + _globals['_OPERATION']._serialized_start=2070 + _globals['_OPERATION']._serialized_end=3261 + _globals['_OPERATION_ARGSENTRY']._serialized_start=3170 + _globals['_OPERATION_ARGSENTRY']._serialized_end=3238 + _globals['_GATE']._serialized_start=3263 + _globals['_GATE']._serialized_end=3281 + _globals['_QUBIT']._serialized_start=3283 + _globals['_QUBIT']._serialized_end=3302 + _globals['_ARG']._serialized_start=3305 + _globals['_ARG']._serialized_end=3461 + _globals['_ARGVALUE']._serialized_start=3464 + _globals['_ARGVALUE']._serialized_end=3841 + _globals['_REPEATEDINT64']._serialized_start=3843 + _globals['_REPEATEDINT64']._serialized_end=3874 + _globals['_REPEATEDDOUBLE']._serialized_start=3876 + _globals['_REPEATEDDOUBLE']._serialized_end=3908 + _globals['_REPEATEDSTRING']._serialized_start=3910 + _globals['_REPEATEDSTRING']._serialized_end=3942 + _globals['_REPEATEDBOOLEAN']._serialized_start=3944 + _globals['_REPEATEDBOOLEAN']._serialized_end=3977 + _globals['_ARGFUNCTION']._serialized_start=3979 + _globals['_ARGFUNCTION']._serialized_end=4045 + _globals['_CIRCUITOPERATION']._serialized_start=4048 + _globals['_CIRCUITOPERATION']._serialized_end=4351 + _globals['_REPETITIONSPECIFICATION']._serialized_start=4354 + _globals['_REPETITIONSPECIFICATION']._serialized_end=4542 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4494 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4522 + _globals['_QUBITMAPPING']._serialized_start=4545 + _globals['_QUBITMAPPING']._serialized_end=4717 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4623 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4717 + _globals['_MEASUREMENTKEY']._serialized_start=4719 + _globals['_MEASUREMENTKEY']._serialized_end=4755 + _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4758 + _globals['_MEASUREMENTKEYMAPPING']._serialized_end=4984 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=4863 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=4984 + _globals['_ARGMAPPING']._serialized_start=4987 + _globals['_ARGMAPPING']._serialized_end=5147 + _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5059 + _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5147 + _globals['_INTERNALGATE']._serialized_start=5150 + _globals['_INTERNALGATE']._serialized_end=5355 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5283 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5355 + _globals['_COUPLERPULSEGATE']._serialized_start=5358 + _globals['_COUPLERPULSEGATE']._serialized_end=5830 + _globals['_CLIFFORDTABLEAU']._serialized_start=5833 + _globals['_CLIFFORDTABLEAU']._serialized_end=5972 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=5974 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6053 + _globals['_IDENTITYGATE']._serialized_start=6055 + _globals['_IDENTITYGATE']._serialized_end=6088 + _globals['_HPOWGATE']._serialized_start=6090 + _globals['_HPOWGATE']._serialized_end=6148 # @@protoc_insertion_point(module_scope) diff --git a/cirq-google/cirq_google/api/v2/program_pb2.pyi b/cirq-google/cirq_google/api/v2/program_pb2.pyi index 3125e02ba00..15f48081e11 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/program_pb2.pyi @@ -10,6 +10,7 @@ import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.message import sys +import tunits.proto.tunits_pb2 import typing if sys.version_info >= (3, 10): @@ -750,6 +751,7 @@ class ArgValue(google.protobuf.message.Message): INT64_VALUES_FIELD_NUMBER: builtins.int DOUBLE_VALUES_FIELD_NUMBER: builtins.int STRING_VALUES_FIELD_NUMBER: builtins.int + VALUE_WITH_UNIT_FIELD_NUMBER: builtins.int float_value: builtins.float string_value: builtins.str double_value: builtins.float @@ -761,6 +763,8 @@ class ArgValue(google.protobuf.message.Message): def double_values(self) -> global___RepeatedDouble: ... @property def string_values(self) -> global___RepeatedString: ... + @property + def value_with_unit(self) -> tunits.proto.tunits_pb2.Value: ... def __init__( self, *, @@ -771,10 +775,11 @@ class ArgValue(google.protobuf.message.Message): int64_values: global___RepeatedInt64 | None = ..., double_values: global___RepeatedDouble | None = ..., string_values: global___RepeatedString | None = ..., + value_with_unit: tunits.proto.tunits_pb2.Value | None = ..., ) -> None: ... - def HasField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> None: ... - def WhichOneof(self, oneof_group: typing.Literal["arg_value", b"arg_value"]) -> typing.Literal["float_value", "bool_values", "string_value", "double_value", "int64_values", "double_values", "string_values"] | None: ... + def HasField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values", "value_with_unit", b"value_with_unit"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values", "value_with_unit", b"value_with_unit"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["arg_value", b"arg_value"]) -> typing.Literal["float_value", "bool_values", "string_value", "double_value", "int64_values", "double_values", "string_values", "value_with_unit"] | None: ... global___ArgValue = ArgValue diff --git a/cirq-google/cirq_google/serialization/arg_func_langs.py b/cirq-google/cirq_google/serialization/arg_func_langs.py index 82104ad5a19..cc386553124 100644 --- a/cirq-google/cirq_google/serialization/arg_func_langs.py +++ b/cirq-google/cirq_google/serialization/arg_func_langs.py @@ -20,6 +20,7 @@ from cirq_google.api import v2 from cirq_google.ops import InternalGate from cirq.qis import CliffordTableau +import tunits SUPPORTED_FUNCTIONS_FOR_LANGUAGE: Dict[Optional[str], FrozenSet[str]] = { '': frozenset(), @@ -33,8 +34,10 @@ SUPPORTED_SYMPY_OPS = (sympy.Symbol, sympy.Add, sympy.Mul, sympy.Pow) # Argument types for gates. -ARG_LIKE = Union[int, float, numbers.Real, Sequence[bool], str, sympy.Expr] -ARG_RETURN_LIKE = Union[float, int, str, List[bool], List[int], List[float], List[str], sympy.Expr] +ARG_LIKE = Union[int, float, numbers.Real, Sequence[bool], str, sympy.Expr, tunits.Value] +ARG_RETURN_LIKE = Union[ + float, int, str, List[bool], List[int], List[float], List[str], sympy.Expr, tunits.Value +] FLOAT_ARG_LIKE = Union[float, sympy.Expr] # Types for comparing floats @@ -182,6 +185,8 @@ def arg_to_proto( ) field, types_tuple = numerical_fields[cur_index] field.extend(types_tuple[0](x) for x in value) + elif isinstance(value, tunits.Value): + msg.arg_value.value_with_unit.MergeFrom(value.to_proto()) else: _arg_func_to_proto(value, arg_function_language, msg) @@ -329,6 +334,8 @@ def arg_from_proto( return [float(v) for v in arg_value.double_values.values] if which_val == 'string_values': return [str(v) for v in arg_value.string_values.values] + if which_val == 'value_with_unit': + return tunits.Value.from_proto(arg_value.value_with_unit) raise ValueError(f'Unrecognized value type: {which_val!r}') if which == 'symbol': diff --git a/cirq-google/cirq_google/serialization/arg_func_langs_test.py b/cirq-google/cirq_google/serialization/arg_func_langs_test.py index 060e7eb1663..f974aa9c7a1 100644 --- a/cirq-google/cirq_google/serialization/arg_func_langs_test.py +++ b/cirq-google/cirq_google/serialization/arg_func_langs_test.py @@ -15,6 +15,8 @@ import inspect from typing import Dict +import tunits.units + import numpy as np import pytest import sympy @@ -291,3 +293,13 @@ def test_clifford_tableau(lang): proto = clifford_tableau_arg_to_proto(ct) tableau = clifford_tableau_from_proto(proto, lang) assert tableau == ct + + +@pytest.mark.parametrize('lang', LANGUAGE_ORDER) +def test_serialize_with_units(lang): + g = cirq_google.InternalGate( + gate_name='test', gate_module='test', parameter_with_unit=3.14 * tunits.units.ns + ) + msg = internal_gate_arg_to_proto(g) + v = internal_gate_from_proto(msg, lang) + assert g == v diff --git a/cirq-google/cirq_google/serialization/circuit_serializer_test.py b/cirq-google/cirq_google/serialization/circuit_serializer_test.py index 2403e7865ba..a40ce590a9c 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer_test.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer_test.py @@ -19,6 +19,8 @@ import sympy from google.protobuf import json_format +import tunits.units + import cirq import cirq_google as cg from cirq_google.api import v2 @@ -741,3 +743,13 @@ def test_circuit_with_couplerpulse(): circuit = cirq.Circuit(cg.experimental.CouplerPulse(cirq.Duration(nanos=1), 2)(Q0, Q1)) msg = cg.CIRCUIT_SERIALIZER.serialize(circuit) assert cg.CIRCUIT_SERIALIZER.deserialize(msg) == circuit + + +def test_circuit_with_units(): + c = cirq.Circuit( + cg.InternalGate( + gate_module='test', gate_name='test', parameter_with_unit=3.14 * tunits.units.ns + )(cirq.q(0, 0)) + ) + msg = cg.CIRCUIT_SERIALIZER.serialize(c) + assert c == cg.CIRCUIT_SERIALIZER.deserialize(msg) diff --git a/dev_tools/build-protos.sh b/dev_tools/build-protos.sh index 5cd6c8eb134..6bd0727955e 100755 --- a/dev_tools/build-protos.sh +++ b/dev_tools/build-protos.sh @@ -30,10 +30,12 @@ cd "$(git rev-parse --show-toplevel)" cd cirq-google || exit $? +TUNITS_PROTO_PATH=$(python -c "import importlib.resources; print(importlib.resources.files('tunits').parent)") + # Build protos for each protobuf package. for package in cirq_google/api/v1 cirq_google/api/v2 do - python -m grpc_tools.protoc -I=. --python_out=. --mypy_out=. ${package}/*.proto + python -m grpc_tools.protoc --proto_path=$TUNITS_PROTO_PATH -I=. --python_out=. --mypy_out=. ${package}/*.proto done # until this is not merged https://github.com/protocolbuffers/protobuf/pull/7470 diff --git a/dev_tools/requirements/deps/protos.txt b/dev_tools/requirements/deps/protos.txt index 011cf96756d..fd41671e8bd 100644 --- a/dev_tools/requirements/deps/protos.txt +++ b/dev_tools/requirements/deps/protos.txt @@ -4,3 +4,5 @@ grpcio-tools~=1.59.0 mypy-protobuf~=3.4 + +tunits>=0.0.1.dev20241105180513 \ No newline at end of file From 7c7cfd5761d49e2bf3806dddd8835b1bd39559c9 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 10:34:24 -0800 Subject: [PATCH 02/13] nit --- dev_tools/requirements/deps/protos.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_tools/requirements/deps/protos.txt b/dev_tools/requirements/deps/protos.txt index fd41671e8bd..65af2e5c1ba 100644 --- a/dev_tools/requirements/deps/protos.txt +++ b/dev_tools/requirements/deps/protos.txt @@ -5,4 +5,4 @@ grpcio-tools~=1.59.0 mypy-protobuf~=3.4 -tunits>=0.0.1.dev20241105180513 \ No newline at end of file +tunits \ No newline at end of file From 39dcaebb89bedfb7ef77a77d72c8302c9e4b5370 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 10:51:14 -0800 Subject: [PATCH 03/13] nit --- dev_tools/build-protos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_tools/build-protos.sh b/dev_tools/build-protos.sh index 6bd0727955e..5e8180f36a4 100755 --- a/dev_tools/build-protos.sh +++ b/dev_tools/build-protos.sh @@ -35,7 +35,7 @@ TUNITS_PROTO_PATH=$(python -c "import importlib.resources; print(importlib.resou # Build protos for each protobuf package. for package in cirq_google/api/v1 cirq_google/api/v2 do - python -m grpc_tools.protoc --proto_path=$TUNITS_PROTO_PATH -I=. --python_out=. --mypy_out=. ${package}/*.proto + python -m grpc_tools.protoc --proto_path="$TUNITS_PROTO_PATH" -I=. --python_out=. --mypy_out=. ${package}/*.proto done # until this is not merged https://github.com/protocolbuffers/protobuf/pull/7470 From abaf676fac90e75177899a3272a799da7f8c351e Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 11:05:57 -0800 Subject: [PATCH 04/13] nit --- dev_tools/requirements/deps/protos.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_tools/requirements/deps/protos.txt b/dev_tools/requirements/deps/protos.txt index 65af2e5c1ba..7deddf04a2a 100644 --- a/dev_tools/requirements/deps/protos.txt +++ b/dev_tools/requirements/deps/protos.txt @@ -5,4 +5,4 @@ grpcio-tools~=1.59.0 mypy-protobuf~=3.4 -tunits \ No newline at end of file +typedunits \ No newline at end of file From b410ffc32536d3df50eb1e925050e4b73c85b362 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 11:33:49 -0800 Subject: [PATCH 05/13] format --- cirq-google/cirq_google/api/v2/program.proto | 2 -- 1 file changed, 2 deletions(-) diff --git a/cirq-google/cirq_google/api/v2/program.proto b/cirq-google/cirq_google/api/v2/program.proto index 140a8ca0236..9bf6d58c85f 100644 --- a/cirq-google/cirq_google/api/v2/program.proto +++ b/cirq-google/cirq_google/api/v2/program.proto @@ -79,8 +79,6 @@ message Moment { repeated CircuitOperation circuit_operations = 2; } - - // The quantum circuit, specified as a series of operations at specific // start times. message Schedule { From 2ecc48ea75494abce95ed5cdd204d10dcf2c7e3e Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 12:28:50 -0800 Subject: [PATCH 06/13] Add DynamicalDecouplingTag to cirq-google --- cirq-google/cirq_google/api/v2/program.proto | 12 ++ cirq-google/cirq_google/api/v2/program_pb2.py | 116 +++++++++--------- .../cirq_google/api/v2/program_pb2.pyi | 41 ++++++- cirq-google/cirq_google/ops/__init__.py | 4 + .../ops/dynamical_decoupling_tag.py | 44 +++++++ .../serialization/circuit_serializer.py | 17 ++- .../serialization/circuit_serializer_test.py | 9 ++ 7 files changed, 184 insertions(+), 59 deletions(-) create mode 100644 cirq-google/cirq_google/ops/dynamical_decoupling_tag.py diff --git a/cirq-google/cirq_google/api/v2/program.proto b/cirq-google/cirq_google/api/v2/program.proto index 9bf6d58c85f..580ba28c988 100644 --- a/cirq-google/cirq_google/api/v2/program.proto +++ b/cirq-google/cirq_google/api/v2/program.proto @@ -243,6 +243,18 @@ message Operation { string token_value = 4; int32 token_constant_index = 5; } + + repeated Tag tags = 22; +} + +message DynamicalDecouplingTag { + optional string protocol = 1; +} + +message Tag { + oneof tag { + DynamicalDecouplingTag dynamical_decoupling = 1; + } } // The instruction identifying the action taken on the quantum computer. diff --git a/cirq-google/cirq_google/api/v2/program_pb2.py b/cirq-google/cirq_google/api/v2/program_pb2.py index fe4e7dfbe52..7c6c86dc2bf 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.py +++ b/cirq-google/cirq_google/api/v2/program_pb2.py @@ -14,7 +14,7 @@ from tunits.proto import tunits_pb2 as tunits_dot_proto_dot_tunits__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xa7\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xf9\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xce\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x12%\n\x04tags\x18\x16 \x03(\x0b\x32\x17.cirq.google.api.v2.Tag\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"<\n\x16\x44ynamicalDecouplingTag\x12\x15\n\x08protocol\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_protocol\"X\n\x03Tag\x12J\n\x14\x64ynamical_decoupling\x18\x01 \x01(\x0b\x32*.cirq.google.api.v2.DynamicalDecouplingTagH\x00\x42\x05\n\x03tag\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xf9\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -71,59 +71,63 @@ _globals['_WAITGATE']._serialized_start=2003 _globals['_WAITGATE']._serialized_end=2067 _globals['_OPERATION']._serialized_start=2070 - _globals['_OPERATION']._serialized_end=3261 - _globals['_OPERATION_ARGSENTRY']._serialized_start=3170 - _globals['_OPERATION_ARGSENTRY']._serialized_end=3238 - _globals['_GATE']._serialized_start=3263 - _globals['_GATE']._serialized_end=3281 - _globals['_QUBIT']._serialized_start=3283 - _globals['_QUBIT']._serialized_end=3302 - _globals['_ARG']._serialized_start=3305 - _globals['_ARG']._serialized_end=3461 - _globals['_ARGVALUE']._serialized_start=3464 - _globals['_ARGVALUE']._serialized_end=3841 - _globals['_REPEATEDINT64']._serialized_start=3843 - _globals['_REPEATEDINT64']._serialized_end=3874 - _globals['_REPEATEDDOUBLE']._serialized_start=3876 - _globals['_REPEATEDDOUBLE']._serialized_end=3908 - _globals['_REPEATEDSTRING']._serialized_start=3910 - _globals['_REPEATEDSTRING']._serialized_end=3942 - _globals['_REPEATEDBOOLEAN']._serialized_start=3944 - _globals['_REPEATEDBOOLEAN']._serialized_end=3977 - _globals['_ARGFUNCTION']._serialized_start=3979 - _globals['_ARGFUNCTION']._serialized_end=4045 - _globals['_CIRCUITOPERATION']._serialized_start=4048 - _globals['_CIRCUITOPERATION']._serialized_end=4351 - _globals['_REPETITIONSPECIFICATION']._serialized_start=4354 - _globals['_REPETITIONSPECIFICATION']._serialized_end=4542 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4494 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4522 - _globals['_QUBITMAPPING']._serialized_start=4545 - _globals['_QUBITMAPPING']._serialized_end=4717 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4623 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4717 - _globals['_MEASUREMENTKEY']._serialized_start=4719 - _globals['_MEASUREMENTKEY']._serialized_end=4755 - _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4758 - _globals['_MEASUREMENTKEYMAPPING']._serialized_end=4984 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=4863 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=4984 - _globals['_ARGMAPPING']._serialized_start=4987 - _globals['_ARGMAPPING']._serialized_end=5147 - _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5059 - _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5147 - _globals['_INTERNALGATE']._serialized_start=5150 - _globals['_INTERNALGATE']._serialized_end=5355 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5283 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5355 - _globals['_COUPLERPULSEGATE']._serialized_start=5358 - _globals['_COUPLERPULSEGATE']._serialized_end=5830 - _globals['_CLIFFORDTABLEAU']._serialized_start=5833 - _globals['_CLIFFORDTABLEAU']._serialized_end=5972 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=5974 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6053 - _globals['_IDENTITYGATE']._serialized_start=6055 - _globals['_IDENTITYGATE']._serialized_end=6088 - _globals['_HPOWGATE']._serialized_start=6090 - _globals['_HPOWGATE']._serialized_end=6148 + _globals['_OPERATION']._serialized_end=3300 + _globals['_OPERATION_ARGSENTRY']._serialized_start=3209 + _globals['_OPERATION_ARGSENTRY']._serialized_end=3277 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3302 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=3362 + _globals['_TAG']._serialized_start=3364 + _globals['_TAG']._serialized_end=3452 + _globals['_GATE']._serialized_start=3454 + _globals['_GATE']._serialized_end=3472 + _globals['_QUBIT']._serialized_start=3474 + _globals['_QUBIT']._serialized_end=3493 + _globals['_ARG']._serialized_start=3496 + _globals['_ARG']._serialized_end=3652 + _globals['_ARGVALUE']._serialized_start=3655 + _globals['_ARGVALUE']._serialized_end=4032 + _globals['_REPEATEDINT64']._serialized_start=4034 + _globals['_REPEATEDINT64']._serialized_end=4065 + _globals['_REPEATEDDOUBLE']._serialized_start=4067 + _globals['_REPEATEDDOUBLE']._serialized_end=4099 + _globals['_REPEATEDSTRING']._serialized_start=4101 + _globals['_REPEATEDSTRING']._serialized_end=4133 + _globals['_REPEATEDBOOLEAN']._serialized_start=4135 + _globals['_REPEATEDBOOLEAN']._serialized_end=4168 + _globals['_ARGFUNCTION']._serialized_start=4170 + _globals['_ARGFUNCTION']._serialized_end=4236 + _globals['_CIRCUITOPERATION']._serialized_start=4239 + _globals['_CIRCUITOPERATION']._serialized_end=4542 + _globals['_REPETITIONSPECIFICATION']._serialized_start=4545 + _globals['_REPETITIONSPECIFICATION']._serialized_end=4733 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4685 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4713 + _globals['_QUBITMAPPING']._serialized_start=4736 + _globals['_QUBITMAPPING']._serialized_end=4908 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4814 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4908 + _globals['_MEASUREMENTKEY']._serialized_start=4910 + _globals['_MEASUREMENTKEY']._serialized_end=4946 + _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4949 + _globals['_MEASUREMENTKEYMAPPING']._serialized_end=5175 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=5054 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=5175 + _globals['_ARGMAPPING']._serialized_start=5178 + _globals['_ARGMAPPING']._serialized_end=5338 + _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5250 + _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5338 + _globals['_INTERNALGATE']._serialized_start=5341 + _globals['_INTERNALGATE']._serialized_end=5546 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5474 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5546 + _globals['_COUPLERPULSEGATE']._serialized_start=5549 + _globals['_COUPLERPULSEGATE']._serialized_end=6021 + _globals['_CLIFFORDTABLEAU']._serialized_start=6024 + _globals['_CLIFFORDTABLEAU']._serialized_end=6163 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=6165 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6244 + _globals['_IDENTITYGATE']._serialized_start=6246 + _globals['_IDENTITYGATE']._serialized_end=6279 + _globals['_HPOWGATE']._serialized_start=6281 + _globals['_HPOWGATE']._serialized_end=6339 # @@protoc_insertion_point(module_scope) diff --git a/cirq-google/cirq_google/api/v2/program_pb2.pyi b/cirq-google/cirq_google/api/v2/program_pb2.pyi index 15f48081e11..87067a23a21 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/program_pb2.pyi @@ -573,6 +573,7 @@ class Operation(google.protobuf.message.Message): QUBIT_CONSTANT_INDEX_FIELD_NUMBER: builtins.int TOKEN_VALUE_FIELD_NUMBER: builtins.int TOKEN_CONSTANT_INDEX_FIELD_NUMBER: builtins.int + TAGS_FIELD_NUMBER: builtins.int token_value: builtins.str token_constant_index: builtins.int @property @@ -629,6 +630,8 @@ class Operation(google.protobuf.message.Message): @property def qubit_constant_index(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... + @property + def tags(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Tag]: ... def __init__( self, *, @@ -653,9 +656,10 @@ class Operation(google.protobuf.message.Message): qubit_constant_index: collections.abc.Iterable[builtins.int] | None = ..., token_value: builtins.str = ..., token_constant_index: builtins.int = ..., + tags: collections.abc.Iterable[global___Tag] | None = ..., ) -> None: ... def HasField(self, field_name: typing.Literal["couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["args", b"args", "couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "qubit_constant_index", b"qubit_constant_index", "qubits", b"qubits", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> None: ... + def ClearField(self, field_name: typing.Literal["args", b"args", "couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "qubit_constant_index", b"qubit_constant_index", "qubits", b"qubits", "singlequbitcliffordgate", b"singlequbitcliffordgate", "tags", b"tags", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> None: ... @typing.overload def WhichOneof(self, oneof_group: typing.Literal["gate_value", b"gate_value"]) -> typing.Literal["xpowgate", "ypowgate", "zpowgate", "phasedxpowgate", "phasedxzgate", "czpowgate", "fsimgate", "iswappowgate", "measurementgate", "waitgate", "internalgate", "couplerpulsegate", "identitygate", "hpowgate", "singlequbitcliffordgate"] | None: ... @typing.overload @@ -663,6 +667,41 @@ class Operation(google.protobuf.message.Message): global___Operation = Operation +@typing.final +class DynamicalDecouplingTag(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + PROTOCOL_FIELD_NUMBER: builtins.int + protocol: builtins.str + def __init__( + self, + *, + protocol: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["_protocol", b"_protocol", "protocol", b"protocol"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["_protocol", b"_protocol", "protocol", b"protocol"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["_protocol", b"_protocol"]) -> typing.Literal["protocol"] | None: ... + +global___DynamicalDecouplingTag = DynamicalDecouplingTag + +@typing.final +class Tag(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + DYNAMICAL_DECOUPLING_FIELD_NUMBER: builtins.int + @property + def dynamical_decoupling(self) -> global___DynamicalDecouplingTag: ... + def __init__( + self, + *, + dynamical_decoupling: global___DynamicalDecouplingTag | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["dynamical_decoupling", b"dynamical_decoupling", "tag", b"tag"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["dynamical_decoupling", b"dynamical_decoupling", "tag", b"tag"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["tag", b"tag"]) -> typing.Literal["dynamical_decoupling"] | None: ... + +global___Tag = Tag + @typing.final class Gate(google.protobuf.message.Message): """The instruction identifying the action taken on the quantum computer.""" diff --git a/cirq-google/cirq_google/ops/__init__.py b/cirq-google/cirq_google/ops/__init__.py index 40cbd340346..1f1b0d78149 100644 --- a/cirq-google/cirq_google/ops/__init__.py +++ b/cirq-google/cirq_google/ops/__init__.py @@ -27,3 +27,7 @@ from cirq_google.ops.sycamore_gate import SycamoreGate as SycamoreGate, SYC as SYC from cirq_google.ops.internal_gate import InternalGate as InternalGate + +from cirq_google.ops.dynamical_decoupling_tag import ( + DynamicalDecouplingTag as DynamicalDecouplingTag, +) diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py new file mode 100644 index 00000000000..ed075223b62 --- /dev/null +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py @@ -0,0 +1,44 @@ +# Copyright 2024 The Cirq Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import attrs + +from typing import Optional +import cirq_google.api.v2.program_pb2 as v2 + + +SUPPORTED_DD_PROTOCOLS = frozenset(["X", "Y"]) + + +@attrs.frozen +class DynamicalDecouplingTag: + "A tag to indicate using DD to fill qubit time." + + protocol: str = attrs.field() # Which DD protocol to use. + + @protocol.validator + def _validate_protocol(self, attribute, value): + assert value in SUPPORTED_DD_PROTOCOLS + + def to_proto( + self, msg: Optional[v2.DynamicalDecouplingTag] = None + ) -> v2.DynamicalDecouplingTag: + if msg is None: + msg = v2.DynamicalDecouplingTag() + msg.protocol = self.protocol + return msg + + @staticmethod + def from_proto(msg: v2.DynamicalDecouplingTag) -> 'DynamicalDecouplingTag': + return DynamicalDecouplingTag(protocol=msg.protocol) diff --git a/cirq-google/cirq_google/serialization/circuit_serializer.py b/cirq-google/cirq_google/serialization/circuit_serializer.py index b128ceda617..44ab1b4cd8e 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer.py @@ -19,7 +19,7 @@ import cirq from cirq_google.api import v2 -from cirq_google.ops import PhysicalZTag, InternalGate, FSimViaModelTag +from cirq_google.ops import PhysicalZTag, InternalGate, FSimViaModelTag, DynamicalDecouplingTag from cirq_google.ops.calibration_tag import CalibrationTag from cirq_google.experimental.ops import CouplerPulse from cirq_google.serialization import serializer, op_deserializer, op_serializer, arg_func_langs @@ -113,6 +113,10 @@ def _serialize_circuit( constants=constants, raw_constants=raw_constants, ) + # for tag in op.tags: + # msg = self._serialize_tag(tag) + # if msg is not None: + # op_pb.tags.append(msg) def _serialize_gate_op( self, @@ -296,6 +300,8 @@ def _serialize_gate_op( constants.append(constant) if raw_constants is not None: raw_constants[tag.token] = msg.token_constant_index + elif isinstance(tag, DynamicalDecouplingTag): + tag.to_proto(msg=msg.tags.add().dynamical_decoupling) return msg def _serialize_circuit_op( @@ -417,13 +423,14 @@ def _deserialize_circuit( for moment_proto in circuit_proto.moments: moment_ops = [] for op in moment_proto.operations: + tags = [self._deserialize_tag(tag) for tag in op.tags] moment_ops.append( self._deserialize_gate_op( op, arg_function_language=arg_function_language, constants=constants, deserialized_constants=deserialized_constants, - ) + ).with_tags(*tags) ) for op in moment_proto.circuit_operations: moment_ops.append( @@ -737,5 +744,11 @@ def _deserialize_circuit_op( deserialized_constants=deserialized_constants, ) + def _deserialize_tag(self, msg: v2.program_pb2.Tag): + which = msg.WhichOneof('tag') + if which == 'dynamical_decoupling': + return DynamicalDecouplingTag.from_proto(msg.dynamical_decoupling) + raise ValueError(f'unsupported tag {msg=}') + CIRCUIT_SERIALIZER = CircuitSerializer() diff --git a/cirq-google/cirq_google/serialization/circuit_serializer_test.py b/cirq-google/cirq_google/serialization/circuit_serializer_test.py index a40ce590a9c..8572d99b477 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer_test.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer_test.py @@ -753,3 +753,12 @@ def test_circuit_with_units(): ) msg = cg.CIRCUIT_SERIALIZER.serialize(c) assert c == cg.CIRCUIT_SERIALIZER.deserialize(msg) + + +def test_circuit_with_dd_tag(): + tag = cg.ops.DynamicalDecouplingTag('X') + c = cirq.Circuit(cirq.X(cirq.q(0)).with_tags(tag)) + msg = cg.CIRCUIT_SERIALIZER.serialize(c) + nc = cg.CIRCUIT_SERIALIZER.deserialize(msg) + assert c == nc + assert nc[0].operations[0].tags == (tag,) From 1463ca5d28fae22b3687318ffd6c6781b946f7d0 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 12:33:47 -0800 Subject: [PATCH 07/13] rebase --- cirq-google/cirq_google/api/v2/program.proto | 3 - cirq-google/cirq_google/api/v2/program_pb2.py | 199 +++++++++--------- .../cirq_google/api/v2/program_pb2.pyi | 11 +- .../serialization/arg_func_langs.py | 11 +- .../serialization/arg_func_langs_test.py | 12 -- .../serialization/circuit_serializer.py | 17 +- .../serialization/circuit_serializer_test.py | 21 -- dev_tools/build-protos.sh | 4 +- dev_tools/requirements/deps/protos.txt | 2 - 9 files changed, 107 insertions(+), 173 deletions(-) diff --git a/cirq-google/cirq_google/api/v2/program.proto b/cirq-google/cirq_google/api/v2/program.proto index 580ba28c988..3d61a857bc8 100644 --- a/cirq-google/cirq_google/api/v2/program.proto +++ b/cirq-google/cirq_google/api/v2/program.proto @@ -1,7 +1,5 @@ syntax = "proto3"; -import "tunits/proto/tunits.proto"; - package cirq.google.api.v2; option java_package = "com.google.cirq.google.api.v2"; @@ -310,7 +308,6 @@ message ArgValue { RepeatedInt64 int64_values = 5; RepeatedDouble double_values = 6; RepeatedString string_values = 7; - tunits.Value value_with_unit = 8; } } diff --git a/cirq-google/cirq_google/api/v2/program_pb2.py b/cirq-google/cirq_google/api/v2/program_pb2.py index 7c6c86dc2bf..07f8d787d00 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.py +++ b/cirq-google/cirq_google/api/v2/program_pb2.py @@ -11,10 +11,9 @@ _sym_db = _symbol_database.Default() -from tunits.proto import tunits_pb2 as tunits_dot_proto_dot_tunits__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xce\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x12%\n\x04tags\x18\x16 \x03(\x0b\x32\x17.cirq.google.api.v2.Tag\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"<\n\x16\x44ynamicalDecouplingTag\x12\x15\n\x08protocol\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_protocol\"X\n\x03Tag\x12J\n\x14\x64ynamical_decoupling\x18\x01 \x01(\x0b\x32*.cirq.google.api.v2.DynamicalDecouplingTagH\x00\x42\x05\n\x03tag\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xf9\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xce\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x12%\n\x04tags\x18\x16 \x03(\x0b\x32\x17.cirq.google.api.v2.Tag\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"<\n\x16\x44ynamicalDecouplingTag\x12\x15\n\x08protocol\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_protocol\"X\n\x03Tag\x12J\n\x14\x64ynamical_decoupling\x18\x01 \x01(\x0b\x32*.cirq.google.api.v2.DynamicalDecouplingTagH\x00\x42\x05\n\x03tag\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xcf\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -32,102 +31,102 @@ _OPERATION.fields_by_name['args']._serialized_options = b'\030\001' _INTERNALGATE_GATEARGSENTRY._options = None _INTERNALGATE_GATEARGSENTRY._serialized_options = b'8\001' - _globals['_PROGRAM']._serialized_start=84 - _globals['_PROGRAM']._serialized_end=299 - _globals['_CONSTANT']._serialized_start=302 - _globals['_CONSTANT']._serialized_end=449 - _globals['_CIRCUIT']._serialized_start=452 - _globals['_CIRCUIT']._serialized_end=664 - _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_start=585 - _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_end=664 - _globals['_MOMENT']._serialized_start=666 - _globals['_MOMENT']._serialized_end=791 - _globals['_SCHEDULE']._serialized_start=793 - _globals['_SCHEDULE']._serialized_end=873 - _globals['_SCHEDULEDOPERATION']._serialized_start=875 - _globals['_SCHEDULEDOPERATION']._serialized_end=971 - _globals['_LANGUAGE']._serialized_start=973 - _globals['_LANGUAGE']._serialized_end=1036 - _globals['_FLOATARG']._serialized_start=1038 - _globals['_FLOATARG']._serialized_end=1145 - _globals['_XPOWGATE']._serialized_start=1147 - _globals['_XPOWGATE']._serialized_end=1205 - _globals['_YPOWGATE']._serialized_start=1207 - _globals['_YPOWGATE']._serialized_end=1265 - _globals['_ZPOWGATE']._serialized_start=1267 - _globals['_ZPOWGATE']._serialized_end=1348 - _globals['_PHASEDXPOWGATE']._serialized_start=1350 - _globals['_PHASEDXPOWGATE']._serialized_end=1468 - _globals['_PHASEDXZGATE']._serialized_start=1471 - _globals['_PHASEDXZGATE']._serialized_end=1644 - _globals['_CZPOWGATE']._serialized_start=1646 - _globals['_CZPOWGATE']._serialized_end=1705 - _globals['_FSIMGATE']._serialized_start=1707 - _globals['_FSIMGATE']._serialized_end=1834 - _globals['_ISWAPPOWGATE']._serialized_start=1836 - _globals['_ISWAPPOWGATE']._serialized_end=1898 - _globals['_MEASUREMENTGATE']._serialized_start=1900 - _globals['_MEASUREMENTGATE']._serialized_end=2001 - _globals['_WAITGATE']._serialized_start=2003 - _globals['_WAITGATE']._serialized_end=2067 - _globals['_OPERATION']._serialized_start=2070 - _globals['_OPERATION']._serialized_end=3300 - _globals['_OPERATION_ARGSENTRY']._serialized_start=3209 - _globals['_OPERATION_ARGSENTRY']._serialized_end=3277 - _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3302 - _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=3362 - _globals['_TAG']._serialized_start=3364 - _globals['_TAG']._serialized_end=3452 - _globals['_GATE']._serialized_start=3454 - _globals['_GATE']._serialized_end=3472 - _globals['_QUBIT']._serialized_start=3474 - _globals['_QUBIT']._serialized_end=3493 - _globals['_ARG']._serialized_start=3496 - _globals['_ARG']._serialized_end=3652 - _globals['_ARGVALUE']._serialized_start=3655 - _globals['_ARGVALUE']._serialized_end=4032 - _globals['_REPEATEDINT64']._serialized_start=4034 - _globals['_REPEATEDINT64']._serialized_end=4065 - _globals['_REPEATEDDOUBLE']._serialized_start=4067 - _globals['_REPEATEDDOUBLE']._serialized_end=4099 - _globals['_REPEATEDSTRING']._serialized_start=4101 - _globals['_REPEATEDSTRING']._serialized_end=4133 - _globals['_REPEATEDBOOLEAN']._serialized_start=4135 - _globals['_REPEATEDBOOLEAN']._serialized_end=4168 - _globals['_ARGFUNCTION']._serialized_start=4170 - _globals['_ARGFUNCTION']._serialized_end=4236 - _globals['_CIRCUITOPERATION']._serialized_start=4239 - _globals['_CIRCUITOPERATION']._serialized_end=4542 - _globals['_REPETITIONSPECIFICATION']._serialized_start=4545 - _globals['_REPETITIONSPECIFICATION']._serialized_end=4733 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4685 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4713 - _globals['_QUBITMAPPING']._serialized_start=4736 - _globals['_QUBITMAPPING']._serialized_end=4908 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4814 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4908 - _globals['_MEASUREMENTKEY']._serialized_start=4910 - _globals['_MEASUREMENTKEY']._serialized_end=4946 - _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4949 - _globals['_MEASUREMENTKEYMAPPING']._serialized_end=5175 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=5054 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=5175 - _globals['_ARGMAPPING']._serialized_start=5178 - _globals['_ARGMAPPING']._serialized_end=5338 - _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5250 - _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5338 - _globals['_INTERNALGATE']._serialized_start=5341 - _globals['_INTERNALGATE']._serialized_end=5546 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5474 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5546 - _globals['_COUPLERPULSEGATE']._serialized_start=5549 - _globals['_COUPLERPULSEGATE']._serialized_end=6021 - _globals['_CLIFFORDTABLEAU']._serialized_start=6024 - _globals['_CLIFFORDTABLEAU']._serialized_end=6163 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=6165 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6244 - _globals['_IDENTITYGATE']._serialized_start=6246 - _globals['_IDENTITYGATE']._serialized_end=6279 - _globals['_HPOWGATE']._serialized_start=6281 - _globals['_HPOWGATE']._serialized_end=6339 + _globals['_PROGRAM']._serialized_start=57 + _globals['_PROGRAM']._serialized_end=272 + _globals['_CONSTANT']._serialized_start=275 + _globals['_CONSTANT']._serialized_end=422 + _globals['_CIRCUIT']._serialized_start=425 + _globals['_CIRCUIT']._serialized_end=637 + _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_start=558 + _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_end=637 + _globals['_MOMENT']._serialized_start=639 + _globals['_MOMENT']._serialized_end=764 + _globals['_SCHEDULE']._serialized_start=766 + _globals['_SCHEDULE']._serialized_end=846 + _globals['_SCHEDULEDOPERATION']._serialized_start=848 + _globals['_SCHEDULEDOPERATION']._serialized_end=944 + _globals['_LANGUAGE']._serialized_start=946 + _globals['_LANGUAGE']._serialized_end=1009 + _globals['_FLOATARG']._serialized_start=1011 + _globals['_FLOATARG']._serialized_end=1118 + _globals['_XPOWGATE']._serialized_start=1120 + _globals['_XPOWGATE']._serialized_end=1178 + _globals['_YPOWGATE']._serialized_start=1180 + _globals['_YPOWGATE']._serialized_end=1238 + _globals['_ZPOWGATE']._serialized_start=1240 + _globals['_ZPOWGATE']._serialized_end=1321 + _globals['_PHASEDXPOWGATE']._serialized_start=1323 + _globals['_PHASEDXPOWGATE']._serialized_end=1441 + _globals['_PHASEDXZGATE']._serialized_start=1444 + _globals['_PHASEDXZGATE']._serialized_end=1617 + _globals['_CZPOWGATE']._serialized_start=1619 + _globals['_CZPOWGATE']._serialized_end=1678 + _globals['_FSIMGATE']._serialized_start=1680 + _globals['_FSIMGATE']._serialized_end=1807 + _globals['_ISWAPPOWGATE']._serialized_start=1809 + _globals['_ISWAPPOWGATE']._serialized_end=1871 + _globals['_MEASUREMENTGATE']._serialized_start=1873 + _globals['_MEASUREMENTGATE']._serialized_end=1974 + _globals['_WAITGATE']._serialized_start=1976 + _globals['_WAITGATE']._serialized_end=2040 + _globals['_OPERATION']._serialized_start=2043 + _globals['_OPERATION']._serialized_end=3273 + _globals['_OPERATION_ARGSENTRY']._serialized_start=3182 + _globals['_OPERATION_ARGSENTRY']._serialized_end=3250 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3275 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=3335 + _globals['_TAG']._serialized_start=3337 + _globals['_TAG']._serialized_end=3425 + _globals['_GATE']._serialized_start=3427 + _globals['_GATE']._serialized_end=3445 + _globals['_QUBIT']._serialized_start=3447 + _globals['_QUBIT']._serialized_end=3466 + _globals['_ARG']._serialized_start=3469 + _globals['_ARG']._serialized_end=3625 + _globals['_ARGVALUE']._serialized_start=3628 + _globals['_ARGVALUE']._serialized_end=3963 + _globals['_REPEATEDINT64']._serialized_start=3965 + _globals['_REPEATEDINT64']._serialized_end=3996 + _globals['_REPEATEDDOUBLE']._serialized_start=3998 + _globals['_REPEATEDDOUBLE']._serialized_end=4030 + _globals['_REPEATEDSTRING']._serialized_start=4032 + _globals['_REPEATEDSTRING']._serialized_end=4064 + _globals['_REPEATEDBOOLEAN']._serialized_start=4066 + _globals['_REPEATEDBOOLEAN']._serialized_end=4099 + _globals['_ARGFUNCTION']._serialized_start=4101 + _globals['_ARGFUNCTION']._serialized_end=4167 + _globals['_CIRCUITOPERATION']._serialized_start=4170 + _globals['_CIRCUITOPERATION']._serialized_end=4473 + _globals['_REPETITIONSPECIFICATION']._serialized_start=4476 + _globals['_REPETITIONSPECIFICATION']._serialized_end=4664 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4616 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4644 + _globals['_QUBITMAPPING']._serialized_start=4667 + _globals['_QUBITMAPPING']._serialized_end=4839 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4745 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4839 + _globals['_MEASUREMENTKEY']._serialized_start=4841 + _globals['_MEASUREMENTKEY']._serialized_end=4877 + _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4880 + _globals['_MEASUREMENTKEYMAPPING']._serialized_end=5106 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=4985 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=5106 + _globals['_ARGMAPPING']._serialized_start=5109 + _globals['_ARGMAPPING']._serialized_end=5269 + _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5181 + _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5269 + _globals['_INTERNALGATE']._serialized_start=5272 + _globals['_INTERNALGATE']._serialized_end=5477 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5405 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5477 + _globals['_COUPLERPULSEGATE']._serialized_start=5480 + _globals['_COUPLERPULSEGATE']._serialized_end=5952 + _globals['_CLIFFORDTABLEAU']._serialized_start=5955 + _globals['_CLIFFORDTABLEAU']._serialized_end=6094 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=6096 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6175 + _globals['_IDENTITYGATE']._serialized_start=6177 + _globals['_IDENTITYGATE']._serialized_end=6210 + _globals['_HPOWGATE']._serialized_start=6212 + _globals['_HPOWGATE']._serialized_end=6270 # @@protoc_insertion_point(module_scope) diff --git a/cirq-google/cirq_google/api/v2/program_pb2.pyi b/cirq-google/cirq_google/api/v2/program_pb2.pyi index 87067a23a21..f8131e40687 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/program_pb2.pyi @@ -10,7 +10,6 @@ import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.message import sys -import tunits.proto.tunits_pb2 import typing if sys.version_info >= (3, 10): @@ -790,7 +789,6 @@ class ArgValue(google.protobuf.message.Message): INT64_VALUES_FIELD_NUMBER: builtins.int DOUBLE_VALUES_FIELD_NUMBER: builtins.int STRING_VALUES_FIELD_NUMBER: builtins.int - VALUE_WITH_UNIT_FIELD_NUMBER: builtins.int float_value: builtins.float string_value: builtins.str double_value: builtins.float @@ -802,8 +800,6 @@ class ArgValue(google.protobuf.message.Message): def double_values(self) -> global___RepeatedDouble: ... @property def string_values(self) -> global___RepeatedString: ... - @property - def value_with_unit(self) -> tunits.proto.tunits_pb2.Value: ... def __init__( self, *, @@ -814,11 +810,10 @@ class ArgValue(google.protobuf.message.Message): int64_values: global___RepeatedInt64 | None = ..., double_values: global___RepeatedDouble | None = ..., string_values: global___RepeatedString | None = ..., - value_with_unit: tunits.proto.tunits_pb2.Value | None = ..., ) -> None: ... - def HasField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values", "value_with_unit", b"value_with_unit"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values", "value_with_unit", b"value_with_unit"]) -> None: ... - def WhichOneof(self, oneof_group: typing.Literal["arg_value", b"arg_value"]) -> typing.Literal["float_value", "bool_values", "string_value", "double_value", "int64_values", "double_values", "string_values", "value_with_unit"] | None: ... + def HasField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["arg_value", b"arg_value"]) -> typing.Literal["float_value", "bool_values", "string_value", "double_value", "int64_values", "double_values", "string_values"] | None: ... global___ArgValue = ArgValue diff --git a/cirq-google/cirq_google/serialization/arg_func_langs.py b/cirq-google/cirq_google/serialization/arg_func_langs.py index cc386553124..82104ad5a19 100644 --- a/cirq-google/cirq_google/serialization/arg_func_langs.py +++ b/cirq-google/cirq_google/serialization/arg_func_langs.py @@ -20,7 +20,6 @@ from cirq_google.api import v2 from cirq_google.ops import InternalGate from cirq.qis import CliffordTableau -import tunits SUPPORTED_FUNCTIONS_FOR_LANGUAGE: Dict[Optional[str], FrozenSet[str]] = { '': frozenset(), @@ -34,10 +33,8 @@ SUPPORTED_SYMPY_OPS = (sympy.Symbol, sympy.Add, sympy.Mul, sympy.Pow) # Argument types for gates. -ARG_LIKE = Union[int, float, numbers.Real, Sequence[bool], str, sympy.Expr, tunits.Value] -ARG_RETURN_LIKE = Union[ - float, int, str, List[bool], List[int], List[float], List[str], sympy.Expr, tunits.Value -] +ARG_LIKE = Union[int, float, numbers.Real, Sequence[bool], str, sympy.Expr] +ARG_RETURN_LIKE = Union[float, int, str, List[bool], List[int], List[float], List[str], sympy.Expr] FLOAT_ARG_LIKE = Union[float, sympy.Expr] # Types for comparing floats @@ -185,8 +182,6 @@ def arg_to_proto( ) field, types_tuple = numerical_fields[cur_index] field.extend(types_tuple[0](x) for x in value) - elif isinstance(value, tunits.Value): - msg.arg_value.value_with_unit.MergeFrom(value.to_proto()) else: _arg_func_to_proto(value, arg_function_language, msg) @@ -334,8 +329,6 @@ def arg_from_proto( return [float(v) for v in arg_value.double_values.values] if which_val == 'string_values': return [str(v) for v in arg_value.string_values.values] - if which_val == 'value_with_unit': - return tunits.Value.from_proto(arg_value.value_with_unit) raise ValueError(f'Unrecognized value type: {which_val!r}') if which == 'symbol': diff --git a/cirq-google/cirq_google/serialization/arg_func_langs_test.py b/cirq-google/cirq_google/serialization/arg_func_langs_test.py index f974aa9c7a1..060e7eb1663 100644 --- a/cirq-google/cirq_google/serialization/arg_func_langs_test.py +++ b/cirq-google/cirq_google/serialization/arg_func_langs_test.py @@ -15,8 +15,6 @@ import inspect from typing import Dict -import tunits.units - import numpy as np import pytest import sympy @@ -293,13 +291,3 @@ def test_clifford_tableau(lang): proto = clifford_tableau_arg_to_proto(ct) tableau = clifford_tableau_from_proto(proto, lang) assert tableau == ct - - -@pytest.mark.parametrize('lang', LANGUAGE_ORDER) -def test_serialize_with_units(lang): - g = cirq_google.InternalGate( - gate_name='test', gate_module='test', parameter_with_unit=3.14 * tunits.units.ns - ) - msg = internal_gate_arg_to_proto(g) - v = internal_gate_from_proto(msg, lang) - assert g == v diff --git a/cirq-google/cirq_google/serialization/circuit_serializer.py b/cirq-google/cirq_google/serialization/circuit_serializer.py index 44ab1b4cd8e..b128ceda617 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer.py @@ -19,7 +19,7 @@ import cirq from cirq_google.api import v2 -from cirq_google.ops import PhysicalZTag, InternalGate, FSimViaModelTag, DynamicalDecouplingTag +from cirq_google.ops import PhysicalZTag, InternalGate, FSimViaModelTag from cirq_google.ops.calibration_tag import CalibrationTag from cirq_google.experimental.ops import CouplerPulse from cirq_google.serialization import serializer, op_deserializer, op_serializer, arg_func_langs @@ -113,10 +113,6 @@ def _serialize_circuit( constants=constants, raw_constants=raw_constants, ) - # for tag in op.tags: - # msg = self._serialize_tag(tag) - # if msg is not None: - # op_pb.tags.append(msg) def _serialize_gate_op( self, @@ -300,8 +296,6 @@ def _serialize_gate_op( constants.append(constant) if raw_constants is not None: raw_constants[tag.token] = msg.token_constant_index - elif isinstance(tag, DynamicalDecouplingTag): - tag.to_proto(msg=msg.tags.add().dynamical_decoupling) return msg def _serialize_circuit_op( @@ -423,14 +417,13 @@ def _deserialize_circuit( for moment_proto in circuit_proto.moments: moment_ops = [] for op in moment_proto.operations: - tags = [self._deserialize_tag(tag) for tag in op.tags] moment_ops.append( self._deserialize_gate_op( op, arg_function_language=arg_function_language, constants=constants, deserialized_constants=deserialized_constants, - ).with_tags(*tags) + ) ) for op in moment_proto.circuit_operations: moment_ops.append( @@ -744,11 +737,5 @@ def _deserialize_circuit_op( deserialized_constants=deserialized_constants, ) - def _deserialize_tag(self, msg: v2.program_pb2.Tag): - which = msg.WhichOneof('tag') - if which == 'dynamical_decoupling': - return DynamicalDecouplingTag.from_proto(msg.dynamical_decoupling) - raise ValueError(f'unsupported tag {msg=}') - CIRCUIT_SERIALIZER = CircuitSerializer() diff --git a/cirq-google/cirq_google/serialization/circuit_serializer_test.py b/cirq-google/cirq_google/serialization/circuit_serializer_test.py index 8572d99b477..2403e7865ba 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer_test.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer_test.py @@ -19,8 +19,6 @@ import sympy from google.protobuf import json_format -import tunits.units - import cirq import cirq_google as cg from cirq_google.api import v2 @@ -743,22 +741,3 @@ def test_circuit_with_couplerpulse(): circuit = cirq.Circuit(cg.experimental.CouplerPulse(cirq.Duration(nanos=1), 2)(Q0, Q1)) msg = cg.CIRCUIT_SERIALIZER.serialize(circuit) assert cg.CIRCUIT_SERIALIZER.deserialize(msg) == circuit - - -def test_circuit_with_units(): - c = cirq.Circuit( - cg.InternalGate( - gate_module='test', gate_name='test', parameter_with_unit=3.14 * tunits.units.ns - )(cirq.q(0, 0)) - ) - msg = cg.CIRCUIT_SERIALIZER.serialize(c) - assert c == cg.CIRCUIT_SERIALIZER.deserialize(msg) - - -def test_circuit_with_dd_tag(): - tag = cg.ops.DynamicalDecouplingTag('X') - c = cirq.Circuit(cirq.X(cirq.q(0)).with_tags(tag)) - msg = cg.CIRCUIT_SERIALIZER.serialize(c) - nc = cg.CIRCUIT_SERIALIZER.deserialize(msg) - assert c == nc - assert nc[0].operations[0].tags == (tag,) diff --git a/dev_tools/build-protos.sh b/dev_tools/build-protos.sh index 5e8180f36a4..5cd6c8eb134 100755 --- a/dev_tools/build-protos.sh +++ b/dev_tools/build-protos.sh @@ -30,12 +30,10 @@ cd "$(git rev-parse --show-toplevel)" cd cirq-google || exit $? -TUNITS_PROTO_PATH=$(python -c "import importlib.resources; print(importlib.resources.files('tunits').parent)") - # Build protos for each protobuf package. for package in cirq_google/api/v1 cirq_google/api/v2 do - python -m grpc_tools.protoc --proto_path="$TUNITS_PROTO_PATH" -I=. --python_out=. --mypy_out=. ${package}/*.proto + python -m grpc_tools.protoc -I=. --python_out=. --mypy_out=. ${package}/*.proto done # until this is not merged https://github.com/protocolbuffers/protobuf/pull/7470 diff --git a/dev_tools/requirements/deps/protos.txt b/dev_tools/requirements/deps/protos.txt index 7deddf04a2a..011cf96756d 100644 --- a/dev_tools/requirements/deps/protos.txt +++ b/dev_tools/requirements/deps/protos.txt @@ -4,5 +4,3 @@ grpcio-tools~=1.59.0 mypy-protobuf~=3.4 - -typedunits \ No newline at end of file From d77d1a59d226182463bed52a644968e713632e66 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 12:35:36 -0800 Subject: [PATCH 08/13] restore --- .../serialization/circuit_serializer.py | 17 +++++++++++++++-- .../serialization/circuit_serializer_test.py | 9 +++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/cirq-google/cirq_google/serialization/circuit_serializer.py b/cirq-google/cirq_google/serialization/circuit_serializer.py index b128ceda617..44ab1b4cd8e 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer.py @@ -19,7 +19,7 @@ import cirq from cirq_google.api import v2 -from cirq_google.ops import PhysicalZTag, InternalGate, FSimViaModelTag +from cirq_google.ops import PhysicalZTag, InternalGate, FSimViaModelTag, DynamicalDecouplingTag from cirq_google.ops.calibration_tag import CalibrationTag from cirq_google.experimental.ops import CouplerPulse from cirq_google.serialization import serializer, op_deserializer, op_serializer, arg_func_langs @@ -113,6 +113,10 @@ def _serialize_circuit( constants=constants, raw_constants=raw_constants, ) + # for tag in op.tags: + # msg = self._serialize_tag(tag) + # if msg is not None: + # op_pb.tags.append(msg) def _serialize_gate_op( self, @@ -296,6 +300,8 @@ def _serialize_gate_op( constants.append(constant) if raw_constants is not None: raw_constants[tag.token] = msg.token_constant_index + elif isinstance(tag, DynamicalDecouplingTag): + tag.to_proto(msg=msg.tags.add().dynamical_decoupling) return msg def _serialize_circuit_op( @@ -417,13 +423,14 @@ def _deserialize_circuit( for moment_proto in circuit_proto.moments: moment_ops = [] for op in moment_proto.operations: + tags = [self._deserialize_tag(tag) for tag in op.tags] moment_ops.append( self._deserialize_gate_op( op, arg_function_language=arg_function_language, constants=constants, deserialized_constants=deserialized_constants, - ) + ).with_tags(*tags) ) for op in moment_proto.circuit_operations: moment_ops.append( @@ -737,5 +744,11 @@ def _deserialize_circuit_op( deserialized_constants=deserialized_constants, ) + def _deserialize_tag(self, msg: v2.program_pb2.Tag): + which = msg.WhichOneof('tag') + if which == 'dynamical_decoupling': + return DynamicalDecouplingTag.from_proto(msg.dynamical_decoupling) + raise ValueError(f'unsupported tag {msg=}') + CIRCUIT_SERIALIZER = CircuitSerializer() diff --git a/cirq-google/cirq_google/serialization/circuit_serializer_test.py b/cirq-google/cirq_google/serialization/circuit_serializer_test.py index 2403e7865ba..7b43fdd6b12 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer_test.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer_test.py @@ -741,3 +741,12 @@ def test_circuit_with_couplerpulse(): circuit = cirq.Circuit(cg.experimental.CouplerPulse(cirq.Duration(nanos=1), 2)(Q0, Q1)) msg = cg.CIRCUIT_SERIALIZER.serialize(circuit) assert cg.CIRCUIT_SERIALIZER.deserialize(msg) == circuit + + +def test_circuit_with_dd_tag(): + tag = cg.ops.DynamicalDecouplingTag('X') + c = cirq.Circuit(cirq.X(cirq.q(0)).with_tags(tag)) + msg = cg.CIRCUIT_SERIALIZER.serialize(c) + nc = cg.CIRCUIT_SERIALIZER.deserialize(msg) + assert c == nc + assert nc[0].operations[0].tags == (tag,) From c4844e01f91742982cb0eafaebefc7894dc8ec33 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 5 Nov 2024 15:07:41 -0800 Subject: [PATCH 09/13] lint --- cirq-google/cirq_google/ops/dynamical_decoupling_tag.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py index ed075223b62..8645dbf3c22 100644 --- a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Optional + import attrs -from typing import Optional import cirq_google.api.v2.program_pb2 as v2 @@ -23,7 +24,7 @@ @attrs.frozen class DynamicalDecouplingTag: - "A tag to indicate using DD to fill qubit time." + """A tag to indicate using DD to fill qubit time.""" protocol: str = attrs.field() # Which DD protocol to use. From 9da8fd45b4da304adcd6693dcea05648257c7c68 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Thu, 7 Nov 2024 13:45:24 -0800 Subject: [PATCH 10/13] add missed file --- .../ops/dynamical_decoupling_tag_test.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py new file mode 100644 index 00000000000..e70d00ff054 --- /dev/null +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py @@ -0,0 +1,26 @@ +# Copyright 2024 The Cirq Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pytest +from cirq_google.ops.dynamical_decoupling_tag import DynamicalDecouplingTag + +def test_invalid_value(): + with pytest.raises(AssertionError): + _ = DynamicalDecouplingTag('_Z') + + +def test_proto_serialization(): + tag = DynamicalDecouplingTag('X') + msg = tag.to_proto() + assert tag == DynamicalDecouplingTag.from_proto(msg) \ No newline at end of file From 5222e2e924fc6c87e0e146aa6e01e8854f79d3df Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Thu, 7 Nov 2024 15:08:16 -0800 Subject: [PATCH 11/13] nit --- cirq-google/cirq_google/api/v2/program_pb2.py | 198 +++++++++--------- .../ops/dynamical_decoupling_tag.py | 9 +- .../ops/dynamical_decoupling_tag_test.py | 5 +- 3 files changed, 110 insertions(+), 102 deletions(-) diff --git a/cirq-google/cirq_google/api/v2/program_pb2.py b/cirq-google/cirq_google/api/v2/program_pb2.py index 2868f174597..7c6c86dc2bf 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.py +++ b/cirq-google/cirq_google/api/v2/program_pb2.py @@ -14,7 +14,7 @@ from tunits.proto import tunits_pb2 as tunits_dot_proto_dot_tunits__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xa7\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xf9\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n cirq_google/api/v2/program.proto\x12\x12\x63irq.google.api.v2\x1a\x19tunits/proto/tunits.proto\"\xd7\x01\n\x07Program\x12.\n\x08language\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.Language\x12.\n\x07\x63ircuit\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12\x30\n\x08schedule\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.ScheduleH\x00\x12/\n\tconstants\x18\x04 \x03(\x0b\x32\x1c.cirq.google.api.v2.ConstantB\t\n\x07program\"\x93\x01\n\x08\x43onstant\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x34\n\rcircuit_value\x18\x02 \x01(\x0b\x32\x1b.cirq.google.api.v2.CircuitH\x00\x12*\n\x05qubit\x18\x03 \x01(\x0b\x32\x19.cirq.google.api.v2.QubitH\x00\x42\r\n\x0b\x63onst_value\"\xd4\x01\n\x07\x43ircuit\x12K\n\x13scheduling_strategy\x18\x01 \x01(\x0e\x32..cirq.google.api.v2.Circuit.SchedulingStrategy\x12+\n\x07moments\x18\x02 \x03(\x0b\x32\x1a.cirq.google.api.v2.Moment\"O\n\x12SchedulingStrategy\x12#\n\x1fSCHEDULING_STRATEGY_UNSPECIFIED\x10\x00\x12\x14\n\x10MOMENT_BY_MOMENT\x10\x01\"}\n\x06Moment\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12@\n\x12\x63ircuit_operations\x18\x02 \x03(\x0b\x32$.cirq.google.api.v2.CircuitOperation\"P\n\x08Schedule\x12\x44\n\x14scheduled_operations\x18\x03 \x03(\x0b\x32&.cirq.google.api.v2.ScheduledOperation\"`\n\x12ScheduledOperation\x12\x30\n\toperation\x18\x01 \x01(\x0b\x32\x1d.cirq.google.api.v2.Operation\x12\x18\n\x10start_time_picos\x18\x02 \x01(\x03\"?\n\x08Language\x12\x14\n\x08gate_set\x18\x01 \x01(\tB\x02\x18\x01\x12\x1d\n\x15\x61rg_function_language\x18\x02 \x01(\t\"k\n\x08\x46loatArg\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x42\x05\n\x03\x61rg\":\n\x08XPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\":\n\x08YPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"Q\n\x08ZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x15\n\ris_physical_z\x18\x02 \x01(\x08\"v\n\x0ePhasedXPowGate\x12\x34\n\x0ephase_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12.\n\x08\x65xponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xad\x01\n\x0cPhasedXZGate\x12\x30\n\nx_exponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x30\n\nz_exponent\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x39\n\x13\x61xis_phase_exponent\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\";\n\tCZPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\x7f\n\x08\x46SimGate\x12+\n\x05theta\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12)\n\x03phi\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\x12\x1b\n\x13translate_via_model\x18\x03 \x01(\x08\">\n\x0cISwapPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"e\n\x0fMeasurementGate\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12,\n\x0binvert_mask\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"@\n\x08WaitGate\x12\x34\n\x0e\x64uration_nanos\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArg\"\xce\t\n\tOperation\x12*\n\x04gate\x18\x01 \x01(\x0b\x32\x18.cirq.google.api.v2.GateB\x02\x18\x01\x12\x30\n\x08xpowgate\x18\x07 \x01(\x0b\x32\x1c.cirq.google.api.v2.XPowGateH\x00\x12\x30\n\x08ypowgate\x18\x08 \x01(\x0b\x32\x1c.cirq.google.api.v2.YPowGateH\x00\x12\x30\n\x08zpowgate\x18\t \x01(\x0b\x32\x1c.cirq.google.api.v2.ZPowGateH\x00\x12<\n\x0ephasedxpowgate\x18\n \x01(\x0b\x32\".cirq.google.api.v2.PhasedXPowGateH\x00\x12\x38\n\x0cphasedxzgate\x18\x0b \x01(\x0b\x32 .cirq.google.api.v2.PhasedXZGateH\x00\x12\x32\n\tczpowgate\x18\x0c \x01(\x0b\x32\x1d.cirq.google.api.v2.CZPowGateH\x00\x12\x30\n\x08\x66simgate\x18\r \x01(\x0b\x32\x1c.cirq.google.api.v2.FSimGateH\x00\x12\x38\n\x0ciswappowgate\x18\x0e \x01(\x0b\x32 .cirq.google.api.v2.ISwapPowGateH\x00\x12>\n\x0fmeasurementgate\x18\x0f \x01(\x0b\x32#.cirq.google.api.v2.MeasurementGateH\x00\x12\x30\n\x08waitgate\x18\x10 \x01(\x0b\x32\x1c.cirq.google.api.v2.WaitGateH\x00\x12\x38\n\x0cinternalgate\x18\x11 \x01(\x0b\x32 .cirq.google.api.v2.InternalGateH\x00\x12@\n\x10\x63ouplerpulsegate\x18\x12 \x01(\x0b\x32$.cirq.google.api.v2.CouplerPulseGateH\x00\x12\x38\n\x0cidentitygate\x18\x13 \x01(\x0b\x32 .cirq.google.api.v2.IdentityGateH\x00\x12\x30\n\x08hpowgate\x18\x14 \x01(\x0b\x32\x1c.cirq.google.api.v2.HPowGateH\x00\x12N\n\x17singlequbitcliffordgate\x18\x15 \x01(\x0b\x32+.cirq.google.api.v2.SingleQubitCliffordGateH\x00\x12\x39\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\'.cirq.google.api.v2.Operation.ArgsEntryB\x02\x18\x01\x12)\n\x06qubits\x18\x03 \x03(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12\x1c\n\x14qubit_constant_index\x18\x06 \x03(\x05\x12\x15\n\x0btoken_value\x18\x04 \x01(\tH\x01\x12\x1e\n\x14token_constant_index\x18\x05 \x01(\x05H\x01\x12%\n\x04tags\x18\x16 \x03(\x0b\x32\x17.cirq.google.api.v2.Tag\x1a\x44\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\x42\x0c\n\ngate_valueB\x07\n\x05token\"<\n\x16\x44ynamicalDecouplingTag\x12\x15\n\x08protocol\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_protocol\"X\n\x03Tag\x12J\n\x14\x64ynamical_decoupling\x18\x01 \x01(\x0b\x32*.cirq.google.api.v2.DynamicalDecouplingTagH\x00\x42\x05\n\x03tag\"\x12\n\x04Gate\x12\n\n\x02id\x18\x01 \x01(\t\"\x13\n\x05Qubit\x12\n\n\x02id\x18\x02 \x01(\t\"\x9c\x01\n\x03\x41rg\x12\x31\n\targ_value\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.ArgValueH\x00\x12\x10\n\x06symbol\x18\x02 \x01(\tH\x00\x12/\n\x04\x66unc\x18\x03 \x01(\x0b\x32\x1f.cirq.google.api.v2.ArgFunctionH\x00\x12\x18\n\x0e\x63onstant_index\x18\x04 \x01(\x05H\x00\x42\x05\n\x03\x61rg\"\xf9\x02\n\x08\x41rgValue\x12\x15\n\x0b\x66loat_value\x18\x01 \x01(\x02H\x00\x12:\n\x0b\x62ool_values\x18\x02 \x01(\x0b\x32#.cirq.google.api.v2.RepeatedBooleanH\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x39\n\x0cint64_values\x18\x05 \x01(\x0b\x32!.cirq.google.api.v2.RepeatedInt64H\x00\x12;\n\rdouble_values\x18\x06 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedDoubleH\x00\x12;\n\rstring_values\x18\x07 \x01(\x0b\x32\".cirq.google.api.v2.RepeatedStringH\x00\x12(\n\x0fvalue_with_unit\x18\x08 \x01(\x0b\x32\r.tunits.ValueH\x00\x42\x0b\n\targ_value\"\x1f\n\rRepeatedInt64\x12\x0e\n\x06values\x18\x01 \x03(\x03\" \n\x0eRepeatedDouble\x12\x0e\n\x06values\x18\x01 \x03(\x01\" \n\x0eRepeatedString\x12\x0e\n\x06values\x18\x01 \x03(\t\"!\n\x0fRepeatedBoolean\x12\x0e\n\x06values\x18\x01 \x03(\x08\"B\n\x0b\x41rgFunction\x12\x0c\n\x04type\x18\x01 \x01(\t\x12%\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xaf\x02\n\x10\x43ircuitOperation\x12\x1e\n\x16\x63ircuit_constant_index\x18\x01 \x01(\x05\x12M\n\x18repetition_specification\x18\x02 \x01(\x0b\x32+.cirq.google.api.v2.RepetitionSpecification\x12\x33\n\tqubit_map\x18\x03 \x01(\x0b\x32 .cirq.google.api.v2.QubitMapping\x12\x46\n\x13measurement_key_map\x18\x04 \x01(\x0b\x32).cirq.google.api.v2.MeasurementKeyMapping\x12/\n\x07\x61rg_map\x18\x05 \x01(\x0b\x32\x1e.cirq.google.api.v2.ArgMapping\"\xbc\x01\n\x17RepetitionSpecification\x12S\n\x0erepetition_ids\x18\x01 \x01(\x0b\x32\x39.cirq.google.api.v2.RepetitionSpecification.RepetitionIdsH\x00\x12\x1a\n\x10repetition_count\x18\x02 \x01(\x05H\x00\x1a\x1c\n\rRepetitionIds\x12\x0b\n\x03ids\x18\x01 \x03(\tB\x12\n\x10repetition_value\"\xac\x01\n\x0cQubitMapping\x12<\n\x07\x65ntries\x18\x01 \x03(\x0b\x32+.cirq.google.api.v2.QubitMapping.QubitEntry\x1a^\n\nQubitEntry\x12&\n\x03key\x18\x01 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.cirq.google.api.v2.Qubit\"$\n\x0eMeasurementKey\x12\x12\n\nstring_key\x18\x01 \x01(\t\"\xe2\x01\n\x15MeasurementKeyMapping\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32=.cirq.google.api.v2.MeasurementKeyMapping.MeasurementKeyEntry\x1ay\n\x13MeasurementKeyEntry\x12/\n\x03key\x18\x01 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".cirq.google.api.v2.MeasurementKey\"\xa0\x01\n\nArgMapping\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.cirq.google.api.v2.ArgMapping.ArgEntry\x1aX\n\x08\x41rgEntry\x12$\n\x03key\x18\x01 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg\"\xcd\x01\n\x0cInternalGate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06module\x18\x02 \x01(\t\x12\x12\n\nnum_qubits\x18\x03 \x01(\x05\x12\x41\n\tgate_args\x18\x04 \x03(\x0b\x32..cirq.google.api.v2.InternalGate.GateArgsEntry\x1aH\n\rGateArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.cirq.google.api.v2.Arg:\x02\x38\x01\"\xd8\x03\n\x10\x43ouplerPulseGate\x12\x37\n\x0chold_time_ps\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x00\x88\x01\x01\x12\x37\n\x0crise_time_ps\x18\x02 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x01\x88\x01\x01\x12:\n\x0fpadding_time_ps\x18\x03 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x02\x88\x01\x01\x12\x37\n\x0c\x63oupling_mhz\x18\x04 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x03\x88\x01\x01\x12\x38\n\rq0_detune_mhz\x18\x05 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x04\x88\x01\x01\x12\x38\n\rq1_detune_mhz\x18\x06 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgH\x05\x88\x01\x01\x42\x0f\n\r_hold_time_psB\x0f\n\r_rise_time_psB\x12\n\x10_padding_time_psB\x0f\n\r_coupling_mhzB\x10\n\x0e_q0_detune_mhzB\x10\n\x0e_q1_detune_mhz\"\x8b\x01\n\x0f\x43liffordTableau\x12\x17\n\nnum_qubits\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1a\n\rinitial_state\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\n\n\x02rs\x18\x03 \x03(\x08\x12\n\n\x02xs\x18\x04 \x03(\x08\x12\n\n\x02zs\x18\x05 \x03(\x08\x42\r\n\x0b_num_qubitsB\x10\n\x0e_initial_state\"O\n\x17SingleQubitCliffordGate\x12\x34\n\x07tableau\x18\x01 \x01(\x0b\x32#.cirq.google.api.v2.CliffordTableau\"!\n\x0cIdentityGate\x12\x11\n\tqid_shape\x18\x01 \x03(\r\":\n\x08HPowGate\x12.\n\x08\x65xponent\x18\x01 \x01(\x0b\x32\x1c.cirq.google.api.v2.FloatArgB/\n\x1d\x63om.google.cirq.google.api.v2B\x0cProgramProtoP\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -32,102 +32,102 @@ _OPERATION.fields_by_name['args']._serialized_options = b'\030\001' _INTERNALGATE_GATEARGSENTRY._options = None _INTERNALGATE_GATEARGSENTRY._serialized_options = b'8\001' - _globals['_PROGRAM']._serialized_start=57 - _globals['_PROGRAM']._serialized_end=272 - _globals['_CONSTANT']._serialized_start=275 - _globals['_CONSTANT']._serialized_end=422 - _globals['_CIRCUIT']._serialized_start=425 - _globals['_CIRCUIT']._serialized_end=637 - _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_start=558 - _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_end=637 - _globals['_MOMENT']._serialized_start=639 - _globals['_MOMENT']._serialized_end=764 - _globals['_SCHEDULE']._serialized_start=766 - _globals['_SCHEDULE']._serialized_end=846 - _globals['_SCHEDULEDOPERATION']._serialized_start=848 - _globals['_SCHEDULEDOPERATION']._serialized_end=944 - _globals['_LANGUAGE']._serialized_start=946 - _globals['_LANGUAGE']._serialized_end=1009 - _globals['_FLOATARG']._serialized_start=1011 - _globals['_FLOATARG']._serialized_end=1118 - _globals['_XPOWGATE']._serialized_start=1120 - _globals['_XPOWGATE']._serialized_end=1178 - _globals['_YPOWGATE']._serialized_start=1180 - _globals['_YPOWGATE']._serialized_end=1238 - _globals['_ZPOWGATE']._serialized_start=1240 - _globals['_ZPOWGATE']._serialized_end=1321 - _globals['_PHASEDXPOWGATE']._serialized_start=1323 - _globals['_PHASEDXPOWGATE']._serialized_end=1441 - _globals['_PHASEDXZGATE']._serialized_start=1444 - _globals['_PHASEDXZGATE']._serialized_end=1617 - _globals['_CZPOWGATE']._serialized_start=1619 - _globals['_CZPOWGATE']._serialized_end=1678 - _globals['_FSIMGATE']._serialized_start=1680 - _globals['_FSIMGATE']._serialized_end=1807 - _globals['_ISWAPPOWGATE']._serialized_start=1809 - _globals['_ISWAPPOWGATE']._serialized_end=1871 - _globals['_MEASUREMENTGATE']._serialized_start=1873 - _globals['_MEASUREMENTGATE']._serialized_end=1974 - _globals['_WAITGATE']._serialized_start=1976 - _globals['_WAITGATE']._serialized_end=2040 - _globals['_OPERATION']._serialized_start=2043 - _globals['_OPERATION']._serialized_end=3273 - _globals['_OPERATION_ARGSENTRY']._serialized_start=3182 - _globals['_OPERATION_ARGSENTRY']._serialized_end=3250 - _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3275 - _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=3335 - _globals['_TAG']._serialized_start=3337 - _globals['_TAG']._serialized_end=3425 - _globals['_GATE']._serialized_start=3427 - _globals['_GATE']._serialized_end=3445 - _globals['_QUBIT']._serialized_start=3447 - _globals['_QUBIT']._serialized_end=3466 - _globals['_ARG']._serialized_start=3469 - _globals['_ARG']._serialized_end=3625 - _globals['_ARGVALUE']._serialized_start=3628 - _globals['_ARGVALUE']._serialized_end=3963 - _globals['_REPEATEDINT64']._serialized_start=3965 - _globals['_REPEATEDINT64']._serialized_end=3996 - _globals['_REPEATEDDOUBLE']._serialized_start=3998 - _globals['_REPEATEDDOUBLE']._serialized_end=4030 - _globals['_REPEATEDSTRING']._serialized_start=4032 - _globals['_REPEATEDSTRING']._serialized_end=4064 - _globals['_REPEATEDBOOLEAN']._serialized_start=4066 - _globals['_REPEATEDBOOLEAN']._serialized_end=4099 - _globals['_ARGFUNCTION']._serialized_start=4101 - _globals['_ARGFUNCTION']._serialized_end=4167 - _globals['_CIRCUITOPERATION']._serialized_start=4170 - _globals['_CIRCUITOPERATION']._serialized_end=4473 - _globals['_REPETITIONSPECIFICATION']._serialized_start=4476 - _globals['_REPETITIONSPECIFICATION']._serialized_end=4664 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4616 - _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4644 - _globals['_QUBITMAPPING']._serialized_start=4667 - _globals['_QUBITMAPPING']._serialized_end=4839 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4745 - _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4839 - _globals['_MEASUREMENTKEY']._serialized_start=4841 - _globals['_MEASUREMENTKEY']._serialized_end=4877 - _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4880 - _globals['_MEASUREMENTKEYMAPPING']._serialized_end=5106 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=4985 - _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=5106 - _globals['_ARGMAPPING']._serialized_start=5109 - _globals['_ARGMAPPING']._serialized_end=5269 - _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5181 - _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5269 - _globals['_INTERNALGATE']._serialized_start=5272 - _globals['_INTERNALGATE']._serialized_end=5477 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5405 - _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5477 - _globals['_COUPLERPULSEGATE']._serialized_start=5480 - _globals['_COUPLERPULSEGATE']._serialized_end=5952 - _globals['_CLIFFORDTABLEAU']._serialized_start=5955 - _globals['_CLIFFORDTABLEAU']._serialized_end=6094 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=6096 - _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6175 - _globals['_IDENTITYGATE']._serialized_start=6177 - _globals['_IDENTITYGATE']._serialized_end=6210 - _globals['_HPOWGATE']._serialized_start=6212 - _globals['_HPOWGATE']._serialized_end=6270 + _globals['_PROGRAM']._serialized_start=84 + _globals['_PROGRAM']._serialized_end=299 + _globals['_CONSTANT']._serialized_start=302 + _globals['_CONSTANT']._serialized_end=449 + _globals['_CIRCUIT']._serialized_start=452 + _globals['_CIRCUIT']._serialized_end=664 + _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_start=585 + _globals['_CIRCUIT_SCHEDULINGSTRATEGY']._serialized_end=664 + _globals['_MOMENT']._serialized_start=666 + _globals['_MOMENT']._serialized_end=791 + _globals['_SCHEDULE']._serialized_start=793 + _globals['_SCHEDULE']._serialized_end=873 + _globals['_SCHEDULEDOPERATION']._serialized_start=875 + _globals['_SCHEDULEDOPERATION']._serialized_end=971 + _globals['_LANGUAGE']._serialized_start=973 + _globals['_LANGUAGE']._serialized_end=1036 + _globals['_FLOATARG']._serialized_start=1038 + _globals['_FLOATARG']._serialized_end=1145 + _globals['_XPOWGATE']._serialized_start=1147 + _globals['_XPOWGATE']._serialized_end=1205 + _globals['_YPOWGATE']._serialized_start=1207 + _globals['_YPOWGATE']._serialized_end=1265 + _globals['_ZPOWGATE']._serialized_start=1267 + _globals['_ZPOWGATE']._serialized_end=1348 + _globals['_PHASEDXPOWGATE']._serialized_start=1350 + _globals['_PHASEDXPOWGATE']._serialized_end=1468 + _globals['_PHASEDXZGATE']._serialized_start=1471 + _globals['_PHASEDXZGATE']._serialized_end=1644 + _globals['_CZPOWGATE']._serialized_start=1646 + _globals['_CZPOWGATE']._serialized_end=1705 + _globals['_FSIMGATE']._serialized_start=1707 + _globals['_FSIMGATE']._serialized_end=1834 + _globals['_ISWAPPOWGATE']._serialized_start=1836 + _globals['_ISWAPPOWGATE']._serialized_end=1898 + _globals['_MEASUREMENTGATE']._serialized_start=1900 + _globals['_MEASUREMENTGATE']._serialized_end=2001 + _globals['_WAITGATE']._serialized_start=2003 + _globals['_WAITGATE']._serialized_end=2067 + _globals['_OPERATION']._serialized_start=2070 + _globals['_OPERATION']._serialized_end=3300 + _globals['_OPERATION_ARGSENTRY']._serialized_start=3209 + _globals['_OPERATION_ARGSENTRY']._serialized_end=3277 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_start=3302 + _globals['_DYNAMICALDECOUPLINGTAG']._serialized_end=3362 + _globals['_TAG']._serialized_start=3364 + _globals['_TAG']._serialized_end=3452 + _globals['_GATE']._serialized_start=3454 + _globals['_GATE']._serialized_end=3472 + _globals['_QUBIT']._serialized_start=3474 + _globals['_QUBIT']._serialized_end=3493 + _globals['_ARG']._serialized_start=3496 + _globals['_ARG']._serialized_end=3652 + _globals['_ARGVALUE']._serialized_start=3655 + _globals['_ARGVALUE']._serialized_end=4032 + _globals['_REPEATEDINT64']._serialized_start=4034 + _globals['_REPEATEDINT64']._serialized_end=4065 + _globals['_REPEATEDDOUBLE']._serialized_start=4067 + _globals['_REPEATEDDOUBLE']._serialized_end=4099 + _globals['_REPEATEDSTRING']._serialized_start=4101 + _globals['_REPEATEDSTRING']._serialized_end=4133 + _globals['_REPEATEDBOOLEAN']._serialized_start=4135 + _globals['_REPEATEDBOOLEAN']._serialized_end=4168 + _globals['_ARGFUNCTION']._serialized_start=4170 + _globals['_ARGFUNCTION']._serialized_end=4236 + _globals['_CIRCUITOPERATION']._serialized_start=4239 + _globals['_CIRCUITOPERATION']._serialized_end=4542 + _globals['_REPETITIONSPECIFICATION']._serialized_start=4545 + _globals['_REPETITIONSPECIFICATION']._serialized_end=4733 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_start=4685 + _globals['_REPETITIONSPECIFICATION_REPETITIONIDS']._serialized_end=4713 + _globals['_QUBITMAPPING']._serialized_start=4736 + _globals['_QUBITMAPPING']._serialized_end=4908 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_start=4814 + _globals['_QUBITMAPPING_QUBITENTRY']._serialized_end=4908 + _globals['_MEASUREMENTKEY']._serialized_start=4910 + _globals['_MEASUREMENTKEY']._serialized_end=4946 + _globals['_MEASUREMENTKEYMAPPING']._serialized_start=4949 + _globals['_MEASUREMENTKEYMAPPING']._serialized_end=5175 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_start=5054 + _globals['_MEASUREMENTKEYMAPPING_MEASUREMENTKEYENTRY']._serialized_end=5175 + _globals['_ARGMAPPING']._serialized_start=5178 + _globals['_ARGMAPPING']._serialized_end=5338 + _globals['_ARGMAPPING_ARGENTRY']._serialized_start=5250 + _globals['_ARGMAPPING_ARGENTRY']._serialized_end=5338 + _globals['_INTERNALGATE']._serialized_start=5341 + _globals['_INTERNALGATE']._serialized_end=5546 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_start=5474 + _globals['_INTERNALGATE_GATEARGSENTRY']._serialized_end=5546 + _globals['_COUPLERPULSEGATE']._serialized_start=5549 + _globals['_COUPLERPULSEGATE']._serialized_end=6021 + _globals['_CLIFFORDTABLEAU']._serialized_start=6024 + _globals['_CLIFFORDTABLEAU']._serialized_end=6163 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_start=6165 + _globals['_SINGLEQUBITCLIFFORDGATE']._serialized_end=6244 + _globals['_IDENTITYGATE']._serialized_start=6246 + _globals['_IDENTITYGATE']._serialized_end=6279 + _globals['_HPOWGATE']._serialized_start=6281 + _globals['_HPOWGATE']._serialized_end=6339 # @@protoc_insertion_point(module_scope) diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py index 8645dbf3c22..374b2f7fc86 100644 --- a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py @@ -19,7 +19,14 @@ import cirq_google.api.v2.program_pb2 as v2 -SUPPORTED_DD_PROTOCOLS = frozenset(["X", "Y"]) +SUPPORTED_DD_PROTOCOLS = frozenset( + [ + "X", # An even number of X + "Y", # An even number of Y + "XY4", # Repititions of XYXY blocks. + "XY8", # Reptitions of XYXYYXYX blocks. + ] +) @attrs.frozen diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py index e70d00ff054..380b6068a2f 100644 --- a/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py @@ -15,12 +15,13 @@ import pytest from cirq_google.ops.dynamical_decoupling_tag import DynamicalDecouplingTag + def test_invalid_value(): with pytest.raises(AssertionError): _ = DynamicalDecouplingTag('_Z') - + def test_proto_serialization(): tag = DynamicalDecouplingTag('X') msg = tag.to_proto() - assert tag == DynamicalDecouplingTag.from_proto(msg) \ No newline at end of file + assert tag == DynamicalDecouplingTag.from_proto(msg) From f122d21748521c7118c4f4a0cf600979290b46dc Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Thu, 7 Nov 2024 15:43:39 -0800 Subject: [PATCH 12/13] nit --- cirq-google/cirq_google/serialization/circuit_serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cirq-google/cirq_google/serialization/circuit_serializer.py b/cirq-google/cirq_google/serialization/circuit_serializer.py index 44ab1b4cd8e..f8332cc8350 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer.py @@ -748,7 +748,7 @@ def _deserialize_tag(self, msg: v2.program_pb2.Tag): which = msg.WhichOneof('tag') if which == 'dynamical_decoupling': return DynamicalDecouplingTag.from_proto(msg.dynamical_decoupling) - raise ValueError(f'unsupported tag {msg=}') + raise ValueError(f'unsupported tag {msg=}') # pragma: no cover CIRCUIT_SERIALIZER = CircuitSerializer() From ddfc7936f13a1561b243b613b6c8e5b03c31b6b9 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Mon, 11 Nov 2024 12:30:56 -0800 Subject: [PATCH 13/13] address comments --- .../ops/dynamical_decoupling_tag.py | 20 +++++++++++-------- .../ops/dynamical_decoupling_tag_test.py | 1 + .../serialization/circuit_serializer.py | 4 ---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py index 374b2f7fc86..111d537e743 100644 --- a/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag.py @@ -16,22 +16,26 @@ import attrs -import cirq_google.api.v2.program_pb2 as v2 +from cirq_google.api.v2 import program_pb2 SUPPORTED_DD_PROTOCOLS = frozenset( [ "X", # An even number of X "Y", # An even number of Y - "XY4", # Repititions of XYXY blocks. - "XY8", # Reptitions of XYXYYXYX blocks. + "XY4", # Repetitions of XYXY blocks. + "XY8", # Repetitions of XYXYYXYX blocks. ] ) @attrs.frozen class DynamicalDecouplingTag: - """A tag to indicate using DD to fill qubit time.""" + """A tag to indicate using DD to fill qubit time. + + Attributes: + protocol: The name of the decoupling protocol (eg 'X', 'XY4'). + """ protocol: str = attrs.field() # Which DD protocol to use. @@ -40,13 +44,13 @@ def _validate_protocol(self, attribute, value): assert value in SUPPORTED_DD_PROTOCOLS def to_proto( - self, msg: Optional[v2.DynamicalDecouplingTag] = None - ) -> v2.DynamicalDecouplingTag: + self, msg: Optional[program_pb2.DynamicalDecouplingTag] = None + ) -> program_pb2.DynamicalDecouplingTag: if msg is None: - msg = v2.DynamicalDecouplingTag() + msg = program_pb2.DynamicalDecouplingTag() msg.protocol = self.protocol return msg @staticmethod - def from_proto(msg: v2.DynamicalDecouplingTag) -> 'DynamicalDecouplingTag': + def from_proto(msg: program_pb2.DynamicalDecouplingTag) -> 'DynamicalDecouplingTag': return DynamicalDecouplingTag(protocol=msg.protocol) diff --git a/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py b/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py index 380b6068a2f..2ef72b32dc5 100644 --- a/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py +++ b/cirq-google/cirq_google/ops/dynamical_decoupling_tag_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + from cirq_google.ops.dynamical_decoupling_tag import DynamicalDecouplingTag diff --git a/cirq-google/cirq_google/serialization/circuit_serializer.py b/cirq-google/cirq_google/serialization/circuit_serializer.py index f8332cc8350..b42eaa8a565 100644 --- a/cirq-google/cirq_google/serialization/circuit_serializer.py +++ b/cirq-google/cirq_google/serialization/circuit_serializer.py @@ -113,10 +113,6 @@ def _serialize_circuit( constants=constants, raw_constants=raw_constants, ) - # for tag in op.tags: - # msg = self._serialize_tag(tag) - # if msg is not None: - # op_pb.tags.append(msg) def _serialize_gate_op( self,