chapter 5

作者: 白敏鸢 | 来源:发表于2018-08-06 15:33 被阅读0次
mnist数据集read/train demo与重构

设计神经网络的5种优化方法

设计神经网络的5种优化方法:优化等级依次降低
激活函数
隐藏层
指数衰减学习率
正则化
滑动平滑

tensorflow模型持久化

##保存文件
import tensorflow as tf
v1 = tf.Variable(tf.constant(1.0, shape=[1], name="v1"))
v2 = tf.Variable(tf.constant(2.0, shape=[1], name="v2"))
result = v1 + v2
init_op = tf.global_variables_initializer()
saver = tf.train.Saver()
with tf.Session() as sess:
    sess.run(init_op)
    saver.save(sess, ".\model\model.ckpt")

1,model.ckpt.meta :图结构
2,model.ckpt: 参数值
3,checkpoint:记录保存信息,通过它可以定位最新保存的模型
4,,model.ckpt.index 文件保存了当前参数名
ps:ckpt:checkpoint


##读取文件
import tensorflow as tf
saver = tf.train.import_meta_graph(".\model\model.ckpt.meta")
with tf.Session() as sess:
    saver.restore(sess, ".\model\model.ckpt")
    print(sess.run(tf.get_default_graph().get_tensor_by_name("add:0")))


https://img-blog.csdn.net/20170707165033334?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbWljaGFlbF95dA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast

[图片上传失败...(image-652906-1533540850432)]

相关文章

网友评论

      本文标题:chapter 5

      本文链接:https://www.haomeiwen.com/subject/sxhdvftx.html