], ), op_serializer.GateOpSerializer( gate_type=ops.ZPowGate, serialized_gate_id='z', args=[ op_serializer.SerializingArg( serialized_name='half_turns', serialized_type=float, op_getter='exponent', ), op_serializer.SerializingArg( serialized_name='type', serialized_type=str, op_getter=lambda op: PHYSICAL_Z if PhysicalZTag() in op.tags else VIRTUAL_Z, ), ], ), op_serializer.GateOpSerializer( gate_type=ops.PhasedXZGate, serialized_gate_id='xyz', args=[ op_serializer.SerializingArg( serialized_name='x_exponent', serialized_type=float, op_getter='x_exponent', ), op_serializer.SerializingArg( serialized_name='z_exponent', serialized_type=float,
def _convert_physical_z(op: ops.Operation, proto: v2.program_pb2.Operation): if 'type' in proto.args: if proto.args['type'].arg_value.string_value == PHYSICAL_Z: return op.with_tags(PhysicalZTag()) return op
def _add_phase_match(op: ops.Operation, proto: v2.program_pb2.Operation): if 'phase_match' in proto.args: if proto.args[ 'phase_match'].arg_value.string_value == PHASE_MATCH_PHYS_Z: return op.with_tags(PhysicalZTag()) return op