note:

if you'll load data,the data shape should be similar with saved data's shape.    -- 中式英语,天下无敌

import tensorflow as tf
import numpy as np # save variable data
W = tf.Variable([[2, 3], [3, 4]], dtype=tf.float32)
b = tf.Variable([[3, 4]], dtype=tf.float32) init = tf.global_variables_initializer()
saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(init)
saver_path = saver.save(sess, 'templates/save_net.ckpt')
print("save path in --", saver_path) # load saved Variable's data
W = tf.Variable(np.arange(2).reshape((1, 2)), dtype=tf.float32) # 2, 2) 二行两列
b = tf.Variable(np.arange(2).reshape((2, 2)), dtype=tf.float32) # (1, 2) 一行两列 saver = tf.train.Saver() with tf.Session() as sess:
saver.restore(sess, 'templates/save_net.ckpt')
print("W: ", sess.run(W))
print("b: ", sess.run(b))

tensorflow data's save and load的更多相关文章

  1. Save and Load from XML

    using UnityEngine; using System.Collections; using System.Xml; using System.Xml.Serialization; using ...

  2. CRM 2013 系统设置新功能一:界面自动保存 及 SDK 中 Xrm.Page.data.entity.save

    CRM 2013 界面会自动保存了..在系统设置中默认“是”,如果不需要可以调整. CRM实体记录在新建时会有出现“保存”按钮,非新建状态下,没有“保存”按钮只有“新建”按钮,系统将会自动为你保存最后 ...

  3. [置顶] .NET下枚举类型的Save和Load分析

    今天在写代码的时候,心血来潮对原来的字符串保存状态位的方式很不满意,对于代码里出现了 state == "1" 这样的状态判断很是不爽.那么理想中的判断是怎样的呢?很简单如你所想枚 ...

  4. docker~save与load的使用

    回到目录 对于没有私有仓库来说,将本地镜像放到其它服务器上执行时,我们可以使用save和load方法,前者用来把镜像保存一个tar文件,后台从一个tar文件恢复成一个镜像,这个功能对于我们开发者来说还 ...

  5. [转帖]Docker save and load镜像保存

    Docker save and load镜像保存 https://www.cnblogs.com/zhuochong/p/10064350.html docker save 和 load 以及 imp ...

  6. dokcer 的export 、improt和save 、load

    export .improt 是对容器操作也就是类似于虚拟机的快照 save .load 是针对于镜像操作的..

  7. docker save docker load

    docker save && docker load docker save 镜像1 镜像2 | gzip > images.tar.gz 打包镜像为压缩文件 docker sa ...

  8. Docker save and load,镜像保存

    一.起因 docker pull 时发生错误 error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/r ...

  9. 详解Pytorch中的网络构造,模型save和load,.pth权重文件解析

    转载:https://zhuanlan.zhihu.com/p/53927068 https://blog.csdn.net/wangdongwei0/article/details/88956527 ...

随机推荐

  1. centos7安装mysql5.7的终极解决方案

    在centos7中安装最新版本mysql5.7.10可能会出现各种各样的问题,不管出现什么问题,先仔细阅读下面,或许对你有帮助! 1.systemctl stop mysqld.service 关闭m ...

  2. Executor 框架详解

    框架最核心的类是ThreadPoolExecutor,它是Java线程池的实现类,通过Executors工具类,可以创建3种类型的ThreadPoolExecutor: 首先附上ThreadPoolE ...

  3. HPU 第三次积分赛:阶乘之和(水题)

    阶乘之和 描述 对于整数pp,给出以下定义 p=x_{1}!+x_{2}!+x_{3}!+...+x_{q}!(x_{i}<x_{j}for\ all\ i<j )p=x1​!+x2​!+ ...

  4. Crazy Computer

    ZS the Coder is coding on a crazy computer. If you don't type in a word for a cconsecutive seconds, ...

  5. UVa 10410 树重建

    Tree Reconstruction Problem Description You have just finished a compiler design homework question w ...

  6. 构建一个dbt 数据库适配器

    脚手架新的适配器 首先,将odbc适配器模板复制到同一目录中的新文件. 更新dbt / adapters / factory.py以将新适配器包含为类型.还要将类型添加到dbt / contracts ...

  7. 【转】Android开源项目(非组件)

    原文网址:http://blog.csdn.net/feizhixuan46789/article/details/9252887 学习开发一个有效的途径就是借鉴成熟的案例作为学习的对象,下面为大家推 ...

  8. oracle之 变更OS时间对数据库的影响

    本文:说明提供了操作系统日期变更对数据库.应用程序数据和作业的影响. 1.它将会影响插入的任何记录,如果涉及到sysdate,则更改日期.2.它还会影响在那个日期运行的任何调度器作业. 如果将系统时间 ...

  9. hdu 4651 Partition && hdu 4658 Integer Partition——拆分数与五边形定理

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=4651 参考:https://blog.csdn.net/u013007900/article/detail ...

  10. 【python】class之类的定义

    使用class定义类,可以提供一个可选的父类或者基类,如果没有合适的基类,那就使用object作为基类,也可以不写.class FooClass (object)或者class FooClass: v ...