cirq.google.SerializableGateSet

class cirq.google.SerializableGateSet(gate_set_name: str, serializers: Iterable[cirq.google.op_serializer.GateOpSerializer], deserializers: Iterable[cirq.google.op_deserializer.GateOpDeserializer])[source]

A class for serializing and deserializing programs and operations.

This class is for cirq.google.api.v2. protos.

__init__(gate_set_name: str, serializers: Iterable[cirq.google.op_serializer.GateOpSerializer], deserializers: Iterable[cirq.google.op_deserializer.GateOpDeserializer])[source]

Construct the gate set.

Parameters
  • gate_set_name – The name used to identify the gate set.

  • serializers – The GateOpSerializers to use for serialization. Multiple serializers for a given gate type are allowed and will be checked for a given type in the order specified here. This allows for a given gate type to be serialized into different serialized form depending on the parameters of the gate.

  • deserializers – The GateOpDeserializers to convert serialized forms of gates to GateOperations.

Methods

deserialize(proto[, device])

Deserialize a Circuit from a cirq.google.api.v2.Program.

deserialize_op(operation_proto, *[, …])

Deserialize an Operation from a cirq.google.api.v2.Operation.

is_supported_operation(op)

Whether or not the given gate can be serialized by this gate set.

serialize(program[, msg, arg_function_language])

Serialize a Circuit to cirq.google.api.v2.Program proto.

serialize_op(op[, msg, arg_function_language])

Serialize an Operation to cirq.google.api.v2.Operation proto.

supported_gate_types()

with_added_gates(*[, gate_set_name, …])

Creates a new gateset with additional (de)serializers.