吴裕雄 python 神经网络——TensorFlow ckpt文件保存方法
import tensorflow as tf v1 = tf.Variable(tf.random_normal([1], stddev=1, seed=1))
v2 = tf.Variable(tf.random_normal([1], stddev=1, seed=1))
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, "E:\\Saved_model\\model.ckpt") with tf.Session() as sess:
saver.restore(sess, "E:\\Saved_model\\model.ckpt")
print(sess.run(result))

saver = tf.train.import_meta_graph("E\\Saved_model\\model.ckpt.meta")
v3 = tf.Variable(tf.random_normal([1], stddev=1, seed=1))
with tf.Session() as sess:
saver.restore(sess, "Saved_model/model.ckpt")
print sess.run(v1)
print sess.run(v2)
print sess.run(v3)#直接加载持久化的图。因为之前没有导出v3,所以这里会报错。

v1 = tf.Variable(tf.constant(1.0, shape=[1]), name = "other-v1")
v2 = tf.Variable(tf.constant(2.0, shape=[1]), name = "other-v2")
saver = tf.train.Saver({"v1": v1, "v2": v2})
吴裕雄 python 神经网络——TensorFlow ckpt文件保存方法的更多相关文章
- 吴裕雄 python 神经网络——TensorFlow pb文件保存方法
import tensorflow as tf from tensorflow.python.framework import graph_util v1 = tf.Variable(tf.const ...
- 吴裕雄 python 神经网络——TensorFlow 数据集基本使用方法
import tempfile import tensorflow as tf input_data = [1, 2, 3, 5, 8] dataset = tf.data.Dataset.from_ ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(2)
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣识别2
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
- 吴裕雄 python 神经网络——TensorFlow 滑动平均类的保存
import tensorflow as tf v = tf.Variable(0, dtype=tf.float32, name="v") for variables in tf ...
- 吴裕雄 python 神经网络TensorFlow实现LeNet模型处理手写数字识别MNIST数据集
import tensorflow as tf tf.reset_default_graph() # 配置神经网络的参数 INPUT_NODE = 784 OUTPUT_NODE = 10 IMAGE ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(4)
# -*- coding: utf-8 -*- import glob import os.path import numpy as np import tensorflow as tf from t ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(3)
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(1)
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
随机推荐
- LTE引理——解决数论竞赛题的利器
LTE (Lifting The Exponent Lemma)引理是一个解指数型不定方程的强力工具.它在Olympiad folklore非常知名,虽然它的起源已经无从查找了.它和Hensel’s ...
- 【转载】Windows环境下JNI的实现实例
转自:http://blog.csdn.net/jjunjoe/article/details/6987183 一.关于JNI: JNI(Java Native Interface):Java本地调用 ...
- jquery--获取input checkbox是否被选中以及渲染checkbox选中状态
jquery获取checkbox是否被选中 html <div><input type="checkbox" id="is_delete" n ...
- EF三种数据库操作模型比较
https://blog.csdn.net/xiongmeiqin/article/details/80196089 EF 中 Code First 的数据迁移以及创建视图 写在前面: EF 中 Co ...
- Spring Boot框架 - 数据访问 - 整合Mybatis
一.新建Spring Boot项目 注意:创建的时候勾选Mybatis依赖,pom文件如下 <dependency> <groupId>org.mybatis.spring.b ...
- curl模拟提交
function curl_post($url, $post){ $options = array( CURLOPT_RETURNTRANSFER =>true, CURLOPT_HEADER ...
- 启动MySQL5.7时报错:initialize specified but the data directory has files in it. Aborting.
启动MySQL5.7时报错:initialize specified but the data directory has files in it. Aborting 解决方法: vim /etc/m ...
- red hat 报错:apt-get:找不到命令
Linux有两个系列:一个是RedHat系列,一个是Debian系列. RedHat系列:Redhat.Centos.Fedora等 Debian系列:Debian.Ubuntu等 RedHat 系列 ...
- HashMap知识初探
public class TestHashMap { /** * HashMap是数组和链表组合构成的数据结构 * 数组里面每个地方都存了key-value这样的实例Java7叫Entry,Java8 ...
- php 基础 字符型转换整形
示例: 可以得出规律:以有效数字开头的,取有效数字.以非有效数字开头的都转换为0: