Simplify auto-generated naming for `CompiledComputation`.
This was previously the bottleneck for serializing large computation graphs. Large computation graphs may fail in other places, but this at least removes a single bottleneck.
This change also removes the bitmask, as `zlib.adler32()` is guaranteed to return an unsigned value under python 3:
@@ -836,8 +836,7 @@ class CompiledComputation(ComputationBuildingBlock):
if name is not None:
self._name = name
else:
- self._name = '{:x}'.format(
- zlib.adler32(repr(self._proto).encode()) & 0xFFFFFFFF)
+ self._name = '{:x}'.format(zlib.adler32(self._proto.SerializeToString()))
@property
def proto(self) -> pb.Computation:
