message: tf.train.Checkpoint: Fix for tensor equality incompatibility in name-based restore logic
diff: @@ -301,7 +301,10 @@ class _NameBasedRestoreCoordinator(object):
  def __init__(self, save_path, dtype_map=None):
  self.save_path = save_path
  self.dtype_map = dtype_map
  - self.unused_attributes = weakref.WeakKeyDictionary()
  + # A map from trackable objects to unused attribute names. We don't have
  + # proto IDs when doing a name-based restore, so the map keys differ from
  + # those in _CheckpointRestoreCoordinator.
  + self.unused_attributes = object_identity.ObjectIdentityWeakKeyDictionary()
  self.restore_uid = ops.uid()
  def globally_named_object_attributes(self, trackable):
  @@ -930,11 +933,14 @@ class NameBasedSaverStatus(_LoadStatus):
  def assert_consumed(self):
  """Raises an exception if any variables/objects are unmatched."""
  - unused_attributes = dict(self._checkpoint.unused_attributes)
  + unused_attributes = list(self._checkpoint.unused_attributes.items())
  if unused_attributes:
  + unused_attribute_strings = [
  + "\n {}: {}".format(obj, attributes)
  + for obj, attributes in unused_attributes]
  raise AssertionError(
  - "Some objects had attributes which were not restored: %s" %
  - (unused_attributes,))
  + "Some objects had attributes which were not restored:{}".format(
  + "".join(unused_attribute_strings)))
  for trackable in self._graph_view.list_objects():
  # pylint: disable=protected-access
  trackable._maybe_initialize_trackable()
  