用法
read(
save_path, options=None
)
參數
-
save_path
write
返回的檢查點路徑。 -
options
可選的tf.train.CheckpointOptions
對象。
返回
-
加載狀態對象,可用於對檢查點恢複的狀態進行斷言。有關詳細信息,請參閱
restore
。
讀取用 write
編寫的訓練檢查點。
讀取此 Checkpoint
及其依賴的任何對象。
此方法與restore()
類似,但不期望檢查點中的save_counter
變量。它隻恢複檢查點已經依賴的對象。
該方法主要供使用write()
而不是save()
並具有自己的機製來編號和跟蹤檢查點的更高級別的檢查點管理實用程序使用。
示例用法:
# Create a checkpoint with write()
ckpt = tf.train.Checkpoint(v=tf.Variable(1.))
path = ckpt.write('/tmp/my_checkpoint')
# Later, load the checkpoint with read()
# With restore() assert_consumed() would have failed.
checkpoint.read(path).assert_consumed()
# You can also pass options to read(). For example this
# runs the IO ops on the localhost:
options = tf.train.CheckpointOptions(
experimental_io_device="/job:localhost")
checkpoint.read(path, options=options)
相關用法
- Python tf.train.Checkpoint.restore用法及代碼示例
- Python tf.train.Checkpoint.save用法及代碼示例
- Python tf.train.Checkpoint.write用法及代碼示例
- Python tf.train.CheckpointOptions用法及代碼示例
- Python tf.train.CheckpointManager用法及代碼示例
- Python tf.train.Checkpoint用法及代碼示例
- Python tf.train.Coordinator.stop_on_exception用法及代碼示例
- Python tf.train.ClusterSpec用法及代碼示例
- Python tf.train.Coordinator用法及代碼示例
- Python tf.train.ExponentialMovingAverage用法及代碼示例
- Python tf.train.list_variables用法及代碼示例
- Python tf.transpose用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.train.Checkpoint.read。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。