class cirq.google.GateOpSerializer(*, gate_type: Type[Gate], serialized_gate_id: str, args: List[cirq.google.op_serializer.SerializingArg], can_serialize_predicate: Callable[cirq.Operation, bool] = <function GateOpSerializer.<lambda>>)[source]

Describes how to serialize a GateOperation for a given Gate type.

gate\_type

The type of the gate that can be serialized.

serialized\_gate\_id

The id used when serializing the gate.

__init__(*, gate_type: Type[Gate], serialized_gate_id: str, args: List[cirq.google.op_serializer.SerializingArg], can_serialize_predicate: Callable[cirq.Operation, bool] = <function GateOpSerializer.<lambda>>)[source]

Construct the serializer.

Parameters
• gate_type – The type of the gate that is being serialized.

• serialized_gate_id – The string id of the gate when serialized.

• can_serialize_predicate – Sometimes an Operation can only be serialized for particular parameters. This predicate will be checked before attempting to serialize the Operation. If the predicate is False, serialization will result in a None value. Default value is a lambda that always returns True.

• args – A list of specification of the arguments to the gate when serializing, including how to get this information from the gate of the given gate type.