MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _RecordLastCheckpoint

Method _RecordLastCheckpoint

tensorflow/python/training/saver.py:1183–1196  ·  view source on GitHub ↗

Manages the list of the latest checkpoints.

(self, latest_save_path)

Source from the content-addressed store, hash-verified

1181 return name
1182
1183 def _RecordLastCheckpoint(self, latest_save_path):
1184 """Manages the list of the latest checkpoints."""
1185 if not self.saver_def.max_to_keep:
1186 return
1187 # Remove first from list if the same name was used before.
1188 for p in self._last_checkpoints:
1189 if latest_save_path == self._CheckpointFilename(p):
1190 self._last_checkpoints.remove(p)
1191 # Append new path to list
1192 self._last_checkpoints.append((latest_save_path, time.time()))
1193
1194 # If more than max_to_keep, remove oldest.
1195 if len(self._last_checkpoints) > self.saver_def.max_to_keep:
1196 self._checkpoints_to_be_deleted.append(self._last_checkpoints.pop(0))
1197
1198 def _MaybeDeleteOldCheckpoints(self, meta_graph_suffix="meta"):
1199 """Deletes old checkpoints if necessary.

Callers 1

saveMethod · 0.95

Calls 5

_CheckpointFilenameMethod · 0.95
timeMethod · 0.80
removeMethod · 0.45
appendMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected