Tensorflow学习: 保存变量和网络
来源:互联网 发布:淘宝小号查询源码 编辑:程序博客网 时间:2024/04/29 13:24
本文内容:
1. 保存网络
2. 在保存网络的路径下保存变量
import tensorflow as tfimport numpy as np### Save to file# remerber to define the same dtype and shape when restore#W = tf.Variable([[1,2,3],[3,4,5]], dtype = tf.float32, name = 'weights')#b = tf.Variable([[1,2,3]], dtype = tf.float32, name = 'biases')##init = tf.global_variables_initializer()##saver = tf.train.Saver()##with tf.Session() as sess:# sess.run(init)# save_path = saver.save(sess, "logs/save_net.ckpt")# print("Save to path: ", save_path)### restore variables# redefine the same shape and same type for your variablesW = tf.Variable(np.arange(6).reshape((2,3)), dtype = tf.float32, name = 'weights')b = tf.Variable(np.arange(3).reshape((1,3)), dtype = tf.float32, name = 'biases')saver = tf.train.Saver()with tf.Session() as sess: saver.restore(sess, "logs/save_net.ckpt") print("Weights: ", sess.run(W)) print("baises: ", sess.run(b))
0 0
- Tensorflow学习: 保存变量和网络
- TensorFlow学习笔记--网络模型的保存和读取
- tensorflow中变量的保存和加载
- 【Python】Tensorflow获取变量,保存网络参数到Matlab格式
- Tensorflow语法学习笔记(一):变量:创建、初始化、保存和加载
- tensorflow保存部分变量
- TensorFlow学习笔记(8)--网络模型的保存和读取
- tensorflow学习笔记(五):变量保存与导入
- TensorFlow入门(三)--变量:创建、初始化、保存和加载
- tensorflow 学习笔记10 网络模型的保存与提取
- Tensorflow-变量保存与导入
- Tensorflow学习:Variable变量
- tensorflow学习:定义变量
- 学习TensorFlow--变量
- tensorflow学习笔记六:保存和加载训练模型
- Tensorflow中变量保存与恢复
- Tensorflow-查看保存的变量及名字
- 学习TensorFlow,保存学习到的网络结构参数并调用
- 二分法的变种
- Python思考
- Jsp标签
- 深度学习几大主流框架的对比
- [leetcode]11. Container With Most Water
- Tensorflow学习: 保存变量和网络
- IOS数据类型及其所有修饰符的使用规则
- leetcode 42Trapping Rain Water
- 重新开始学习android吧之一些基础(二)
- 图像处理-形态学操作
- Maven web project error "import com.sun.image.codec.jpeg.*"
- 微信运动刷步实践教程
- 将train.prototxt文件转为deploy.prototxt文件
- poj 2777 Count Color(线段树)