class_docstr: Manages multiple checkpoints by keeping some and deleting unneeded ones.
  
  Example usage:
  
  ```python
  import tensorflow as tf
  checkpoint = tf.train.Checkpoint(optimizer=optimizer, model=model)
  manager = tf.train.CheckpointManager(
      checkpoint, directory="/tmp/model", max_to_keep=5)
  status = checkpoint.restore(manager.latest_checkpoint)
  while True:
    # train
    manager.save()
  ```
  
  `CheckpointManager` preserves its own state across instantiations (see the
  `__init__` documentation for details). Only one should be active in a
  particular directory at a time.
class_docstr_tok: ["Manages","multiple","checkpoints","by","keeping","some","and","deleting","unneeded","ones",".","Example","usage",":","``","`","python","import","tensorflow","as","tf","checkpoint","=","tf.train.Checkpoint","(","optimizer=optimizer",",","model=model",")","manager","=","tf.train.CheckpointManager","(","checkpoint",",","directory=","''","\/tmp\/model","''",",","max_to_keep=5",")","status","=","checkpoint.restore","(","manager.latest_checkpoint",")","while","True",":","#","train","manager.save","(",")","``","`","`","CheckpointManager","`","preserves","its","own","state","across","instantiations","(","see","the","`","__init__","`","documentation","for","details",")",".","Only","one","should","be","active","in","a","particular","directory","at","a","time","."]
docstr: Saves the `CheckpointManager`'s state in `directory`.
docstr_tok: ["Saves","the","`","CheckpointManager","`","'s","state","in","`","directory","`","."]
code: def _record_state(self):
      """Saves the `CheckpointManager`'s state in `directory`."""
      filenames, timestamps = zip(*self._maybe_delete.items())
      update_checkpoint_state_internal(
          self._directory,
          model_checkpoint_path=self.latest_checkpoint,
          all_model_checkpoint_paths=filenames,
          all_model_checkpoint_timestamps=timestamps,
          last_preserved_timestamp=self._last_preserved_timestamp,
          save_relative_paths=True,
      )
  
imports: import collections
  import copy
  import os.path
  import re
  import time
  from google.protobuf import text_format
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python.checkpoint import checkpoint_options
  from tensorflow.python.eager import context
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import training_util
  from tensorflow.python.training.checkpoint_state_pb2 import CheckpointState
  from tensorflow.python.util import compat
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 7 for calling the CheckpointManager obj's underlying member method code with example usage: obj._record_state() without return types