cirq_google.serialization.tag_serializer.TagSerializer

Generic supertype for tag serializers.

Each tag serializer describes how to serialize a specific type of tags to its corresponding proto format.

Methods

can_serialize_tag

View source

Whether the given tag can be serialized by this serializer.

to_proto

View source

Converts tag to proto using this serializer.

If self.can_serialize_tag(tag) == False, this should return None.

Args
tag The tag to be serialized.
msg An optional proto object to populate with the serialization results.
constants The list of previously-serialized Constant protos.
raw_constants A map raw objects to their respective indices in constants.

Returns
The proto-serialized version of tag. If msg was provided, it is the returned object.