Tensorflow 保存和加载模型
来源:互联网 发布:python宝典 编辑:程序博客网 时间:2024/06/05 05:32
import tensorflow as tfdef save_model(): v1 = tf.Variable(tf.constant(1.0,shape=[1]),name='v1') v2 = tf.Variable(tf.constant(2.0,shape=[1]),name='v2') res = tf.add(v1,v2,name='add_res') saver = tf.train.Saver() with tf.Session() as sess: sess.run(tf.global_variables_initializer()) saver.save(sess,'./save/model.ckpt')def restore_model(): saver = tf.train.import_meta_graph('./save/model.ckpt.meta') with tf.Session() as sess: saver.restore(sess,'./save/model.ckpt') print (sess.run(tf.get_default_graph().get_tensor_by_name('add_res:0')))if __name__=='__main__': save_mode() #第二次运行本程序时,需要注释这一句。 restore_model()
阅读全文
0 0
- tensorflow保存 和 加载模型
- Tensorflow 保存和加载模型
- tensorflow保存和加载模型
- tensorflow 保存和加载模型 -2
- tensorflow模型参数保存和加载问题
- TensorFlow保存和加载训练模型
- tensorflow-模型保存和加载(二)
- TensorFlow保存和加载训练模型
- 使用tensorflow保存、加载和使用模型
- TensorFlow保存和加载训练模型
- Tensorflow加载预训练模型和保存模型
- tensorflow 模型保存与加载
- TensorFlow 模型保存与加载
- tensorflow学习笔记六:保存和加载训练模型
- tensorflow之保存模型与加载模型
- Tensorflow保存和读取模型
- 保存和读取 TensorFlow 模型
- tensorflow保存加载模型查看训练参数
- 基本数据类型包装类
- [Unity3D·CSV篇]01.CSV新手级读取
- 微信小程序 实现城市名称拼音搜索框 汉字/拼音(城市区县定位模块)
- c 字符串处理函数,字符串类和字符串变量
- 两点距离
- Tensorflow 保存和加载模型
- PHP中MySQL的连接封装
- 2017图灵杯问题E 简单的RMQ(RMQ)
- handler源码分析
- 到底什么时候该使用MQ?(MQ使用场景分析)
- 【python 下载器】python下载电影&视频&电视剧
- 我的博客开端
- Hbase架构与原理
- 一种摄像机跟随方式