Make ConcreteFunction.pretty_printed_signature deterministic.
PiperOrigin-RevId: 309576809 Change-Id: Iacdba60cd1d0b1d8da887bb41143e89c70bedc43
This commit is contained in:
parent
71e1316f59
commit
14e27e3b9b
@ -22,6 +22,7 @@ from __future__ import print_function
|
||||
import collections
|
||||
import functools
|
||||
import itertools
|
||||
import pprint
|
||||
import threading
|
||||
import types as types_lib
|
||||
import weakref
|
||||
@ -2221,7 +2222,8 @@ class ConcreteFunction(object):
|
||||
pieces = nest.flatten(spec, expand_composites=False)
|
||||
markers = [_Marker("<{}>".format(i + 1)) for i in range(len(pieces))]
|
||||
structure = nest.pack_sequence_as(spec, markers)
|
||||
result = "{}".format(structure)
|
||||
# Ensure dictionaries are sorted by key (for determinism)
|
||||
result = pprint.pformat(structure, width=10000)
|
||||
for (marker, piece) in zip(markers, pieces):
|
||||
result += "\n {}: {}".format(marker, pretty_print_spec(piece))
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user