tensorflow模型存储结构研究
发布时间
阅读量:
阅读量
TensorFlow模型的存储功能所采用的函数为:
tf.train.Saver()
例如以下代码示例:
import tensorflow as tfv1= tf.Variable(tf.random_normal([784, 200], stddev=0.35), name="v1")v2= tf.Variable(tf.zeros([200]), name="v2")v3= tf.Variable(tf.zeros([100]), name="v3")saver = tf.train.Saver()with tf.Session() as sess: init_op = tf.global_variables_initializer() sess.run(init_op) saver.save(sess,"checkpoint/model.ckpt",global_step=1)
执行完成后,模型文件被成功存储,生成了三个不同类型的文件,具体包括.data、.meta以及.index。
model.ckpt.data-00000-of-00001model.ckpt.indexmodel.ckpt.meta
模型的加载方式为:
with tf.Sessio
全部评论 (0)
还没有任何评论哟~
