Describes how to deserialize a proto to a given Gate type.

Inherits From: OpDeserializer

serialized_gate_id The serialized id of the gate that is being deserialized.
gate_constructor A function that produces the deserialized gate given arguments from args.
args A list of the arguments to be read from the serialized gate and the information required to use this to construct the gate using the gate_constructor above.
num_qubits_param Some gate constructors require that the number of qubits be passed to their constructor. This is the name of the parameter in the constructor for this value. If None, no number of qubits is passed to the constructor.
op_wrapper An optional Callable to modify the resulting GateOperation, for instance, to add tags
deserialize_tokens Whether to convert tokens to CalibrationTags. Defaults to True.

serialized_gate_id The id used when serializing the gate.
serialized_id Returns the string identifier for the accepted serialized objects.

This ID denotes the serialization format this deserializer consumes. For example, one of the common deserializers converts objects with the id 'xy' into PhasedXPowGates.



View source

Turns a cirq_google.api.v2.Operation proto into a GateOperation.

proto The proto object to be deserialized.
arg_function_language The arg_function_language field from Program.Language.
constants The list of Constant protos referenced by constant table indices in proto.
deserialized_constants Unused in this method.

The deserialized GateOperation represented by proto.

ValueError If the proto references a missing constants table, or a required arg is missing.