class str, serializers: Iterable[], deserializers: Iterable[])[source]

A class for serializing and deserializing programs and operations.

This class is for protos.

__init__(gate_set_name: str, serializers: Iterable[], deserializers: Iterable[])[source]

Construct the gate set.

  • 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.


deserialize(proto[, device])

Deserialize a Circuit from a

deserialize_op(operation_proto, *[, …])

Deserialize an Operation from a


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

serialize(program[, msg, arg_function_language])

Serialize a Circuit to proto.

serialize_op(op[, msg, arg_function_language])

Serialize an Operation to proto.


with_added_gates(*[, gate_set_name, …])

Creates a new gateset with additional (de)serializers.