阅读文档后,我在中保存了一个模型TensorFlow
,这是我的演示代码:
# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
...
# Add an op to initialize the variables.
init_op = tf.global_variables_initializer()
# Add ops to save and restore all the variables.
saver = tf.train.Saver()
# Later, launch the model, initialize the variables, do some work, save the
# variables to disk.
with tf.Session() as sess:
sess.run(init_op)
# Do some work with the model.
..
# Save the variables to disk.
save_path = saver.save(sess, "/tmp/model.ckpt")
print("Model saved in file: %s" % save_path)
但是之后,我发现有3个文件
model.ckpt.data-00000-of-00001
model.ckpt.index
model.ckpt.meta
而且我无法通过还原model.ckpt
文件来还原模型,因为没有这样的文件。这是我的代码
with tf.Session() as sess:
# Restore variables from disk.
saver.restore(sess, "/tmp/model.ckpt")
那么,为什么有3个文件?