吴裕雄 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 ...
随机推荐
- Educational Codeforces Round 82 (Rated for Div. 2)E(DP,序列自动机)
#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],t[]; int n,m; ][]; ...
- 使用yum时出现Error: rpmdb open failed解决方案
一.问题描述 使用yum安装软件时出现Error: rpmdb open failed,报错信息显示rpm数据库被损坏. 二.解决方案 重建rpm数据库. [root@localhost yum.re ...
- Unity Hub破解
1.退出UnityHub,安装好nodejs后,用Win+R输入"cmd"执行以下命令 npm install -g asar 2.打开UnityHub安装目录如 C:\Progr ...
- EntityFramework 根据时间筛选数据
需求:根据当前时间,获取条件合适的数据,其中截止时间只比较日期. 1. 运行会报错的版本: var lifeWorkEventBatch = clientRepositoryContainer.Lif ...
- win7安装mysql数据库
1. 软件准备,以64位系统为例如果是32位的下载32位压缩包即可] https://dev.mysql.com/downloads/mysql/ 2.下载解压到本地,将解压路径的bin目录配置到环境 ...
- Java - 判断字符串是否是回文
首先,回文是指类似于“12345”,“abcdcba”的形式,即正念和反念都是一样的字符串 判断字符串是否是回文,这边介绍3种办法 将字符串翻转,判断翻转后的字符串和原字符串是否相等 public s ...
- Duizi and Shunzi HDU
Duizi and Shunzi Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 前端——语言——Core JS——《The good part》读书笔记——第八章节(Methods)
本章介绍JS核心对象的方法.这些对象包括Array,Function,Number,Object,RegExp,String.除这些常用的核心对象还有Date,JSON. 本章更偏向于API文档,介绍 ...
- go基础_接口断言
// interface package main import ( "fmt" ) //定义一个接口,接口名字Inter,接口的方法集有2个方法 type Inter inter ...
- 洛谷 P3901 数列找不同(莫队)
题目链接:https://www.luogu.com.cn/problem/P3901 这道题简单莫队模板题,然后$add$和$del$分别处理$vis[]$从$0-->1$和从$1--> ...