tensorflow函数解析: tf.Session() 和tf.InteractiveSession()
链接如下:
http://stackoverflow.com/questions/41791469/difference-between-tf-session-and-tf-interactivesession
英文
Question:
Questions says everything, for taking sess=
tf.Session() and sess=tf.InteractiveSession() which cases should be
considered for what purpose ? When I am using former one some function
didn't work and when changed to the later it worked (for
example .eval()).
Answer:
Mainly taken from official documentation:
The
only difference with a regular Session is that an InteractiveSession
installs itself as the default session on construction. The methods
Tensor.eval() and Operation.run() will use
that session to run ops.
This allows to use interactive context, like shell, as it avoids having to pass an explicit Session object to run op:
sess = tf.InteractiveSession()
a = tf.constant(5.0)
b = tf.constant(6.0)
c = a * b
# We can just use 'c.eval()' without passing 'sess'
print(c.eval())
sess.close()
It is also possible to say, that InteractiveSession supports less typing, as allows to run variables without needing to constantly refer to the session object.
中文
问题: tf.Session()和tf.InteractiveSession()的区别?
答案:
唯一的区别在于:tf.InteractiveSession()加载它自身作为默认构建的session,tensor.eval()和operation.run()取决于默认的session.
换句话说:InteractiveSession 输入的代码少,原因就是它允许变量不需要使用session就可以产生结构。
tensorflow函数解析: tf.Session() 和tf.InteractiveSession()的更多相关文章
- tensorflow函数解析:Session.run和Tensor.eval的区别
tensorflow函数解析:Session.run和Tensor.eval 翻译 2017年04月20日 15:05:50 标签: tensorflow / 机器学习 / 深度学习 / python ...
- tensorflow函数解析:Session.run和Tensor.eval
原问题链接: http://stackoverflow.com/questions/33610685/in-tensorflow-what-is-the-difference-between-sess ...
- tf.Session()、tf.InteractiveSession()
tf.Session()和tf.InteractiveSession()的区别 官方tutorial是这么说的: The only difference with a regular Session ...
- 【转载】 TensorFlow函数:tf.Session()和tf.Session().as_default()的区别
原文地址: https://blog.csdn.net/Enchanted_ZhouH/article/details/77571939 ------------------------------- ...
- tf.Session()和tf.InteractiveSession()的区别
官方tutorial是这么说的: The only difference with a regular Session is that an InteractiveSession installs i ...
- tf.transpose函数解析
tf.transpose函数解析 觉得有用的话,欢迎一起讨论相互学习~Follow Me tf.transpose(a, perm = None, name = 'transpose') 解释 将a进 ...
- tf.slice函数解析
tf.slice函数解析 觉得有用的话,欢迎一起讨论相互学习~Follow Me tf.slice(input_, begin, size, name = None) 解释 : 这个函数的作用是从输入 ...
- 【转载】 TensorFlow学习——tf.GPUOptions和tf.ConfigProto用法解析
原文地址: https://blog.csdn.net/c20081052/article/details/82345454 ------------------------------------- ...
- 深度学习原理与框架-Tensorflow基本操作-变量常用操作 1.tf.random_normal(生成正态分布随机数) 2.tf.random_shuffle(进行洗牌操作) 3. tf.assign(赋值操作) 4.tf.convert_to_tensor(转换为tensor类型) 5.tf.add(相加操作) tf.divide(相乘操作) 6.tf.placeholder(输入数据占位
1. 使用tf.random_normal([2, 3], mean=-1, stddev=4) 创建一个正态分布的随机数 参数说明:[2, 3]表示随机数的维度,mean表示平均值,stddev表示 ...
随机推荐
- linux----查看系统版本命令
uname -a 可显示电脑以及操作系统的相关信息 cat /proc/version 说明正在运行的内核版本 cat /etc/issue 显示的是发行版本信息
- 面向对象第一个特征-封装(Encapsulation)
面向对象第一个特征-封装(Encapsulation) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.封装概述(Encapsulation) 1>.什么是封装 是指隐藏对 ...
- vs使用opencv总提示igdrclneo64.dll异常.exe: 0xC0000005:的解决方法
最近项目中要使用opencv库,搭建好环境,使用接口的时候,总提示 igdrclneo64.dll报错崩溃,一直怀疑是自己程序的问题,后面经过一系列的查资料才解决 解决办法: 本地环境:vs2015+ ...
- Spring的数据源配置
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- Dynamics CRM - 解决无法使用 Ribbon Workbench 2016 定制 Sub-Grid View Button 的问题(SubGrid MainTab 消失之谜)
发现问题: 在 Dynamics CRM 开发中,会经常使用 Ribbon Workbench 工具来定制 Button 或者对已有 Button 进行自定义功能开发,比如隐藏 SubGrid 的 A ...
- MyBatis 关联查询的实现:一对一
有2个实体:用户.会员卡,一个用户只能办理一张会员卡,即一对一. user_tb : 需要在一方引入另一方的主键作为外键. card_tb: 使用扩展类 (1)在pojo包下新建User类: pack ...
- swift中利用系统线程实现异步加载数据同步更新UI
swift中的使用案例样式 // Mark: -数据源更新 typealias AddDataBlock = () ->Void var updataBlock:AddDataBlock? fu ...
- mac安装浏览器同步测试工具
1.安装node.js (1)打开终端,输入以下命令安装Homebrew ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebre ...
- 项目进度02-Day3
①今天做了什么? 数据库数据的重置.之前的用户类字段的补充.简单的平台信息查询 ②明天要做什么? 分类浏览和综合查询功能. ③遇到了什么问题? 出现问题:Parameter index out o ...
- python 进程和线程(2)
这篇博客是按照博客<进程和线程(1)>中内容用futures改写 with futures.ProcessPoolExecutor() as executor:可以两篇博客对照看. 2改 ...