tensorflow模型提取,和使用模型做测试

如果我已经通过
saver = tf.train.Saver()

保存了一个模型,然后我要读取模型,代码如下

saver = tf.train.Saver()
gpu_options = tf.GPUOptions(allow_growth=True)

        with tf.Session(config=tf.ConfigProto(log_device_placement=False, allow_soft_placement=True,
                                              gpu_options=gpu_options)) as sess:
            saver.restore(sess,'/home/user/python/tensorflow_1/tensorflow_exercise/model/cifar_new8.ckpt')
            # sess.run(init_op)
            images_batch, labels_batch=sess.run([images_test, labels_test])
            aaa=sess.run(images_holder,feed_dict={images_holder:images_batch,labels_holder:labels_batch})
            print(aaa)
            print("训练完毕!")
saver,restore的是原来保存的模型,其实回收的模型和普通的网络设计是一样的,也需要通过 sess.run来传递数据,然后 sess.run
来查看某个节点的数据,然后print来输出,只是多了一个saver.restore而已,其他的没有什么区别。
,,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值