TensorFlow发布Eager,便于Debug!
来源:互联网 发布:mac pdf转word网页版 编辑:程序博客网 时间:2024/06/05 12:48
要查看网络中间结果,使用TensorFlow的小伙伴都知道,必须要run一下session,返回对应的值才能查看,这是很不方便的。为此,TensorFlow团队发布了eager,可以实时查看中间结果,便于大家Debug。那么怎么来用呢?今天简单介绍一下。
1. 安装
Eager execution已经包含在最新的1.4版本中,有两个办法可以安装,一是本地编译安装TensorFlow 1.4可以生成eager,二是安装轻量级的库:
pip install tf-nightly # (for CPU-only TensorFlow)pip install tf-nightly-gpu # (for GPU-enabled TensorFlow)
2. 使用
import tensorflow.contrib.eager as tfetfe.enable_eager_execution()
在头文件中import eager库,并激活eager execution,后面默认eager一直处于激活状态。这个时候,中间结果像numpy结构的数据一样,可以直接打印输出。
此外,还有一个优势,tensor和numpy可以自动互相调用。
import numpy as npnp_x = np.array(2., dtype=np.float32)x = tf.constant(np_x)py_y = 3.y = tf.constant(py_y)z = x + y + 1print(z)print(z.numpy())# Outputtf.Tensor(6.0, shape=(), dtype=float32)6.0这个真的展示了TF的特点,快速,灵活!
更多资料,请查看:
TensorFlow Eager Execution
阅读全文
0 0
- TensorFlow发布Eager,便于Debug!
- TensorFlow发布「eager」模式,更易操作!
- tensorflow debug
- TensorFlow引入了动态图机制Eager Execution
- TensorFlow推出命令式、可定义的运行接口Eager Execution
- 终于!TensorFlow引入了动态图机制Eager Execution
- 紧跟未来深度学习框架需求,TensorFlow 推出 Eager Execution
- tensorflow debug c++ code
- Hadoop2 调整日志级别为DEBUG便于调试
- Elastic-Job dump作业运行信息(便于开发者debug)
- 【TensorFlow | 升级】TensorFlow 1.0 发布
- TensorFlow 1.0正式发布
- 发布TensorFlow 1.4
- 谷歌发布 TensorFlow Serving
- Google Developers:发布TensorFlow Lite
- debug tensorflow / 使用gdb调试tensorflow底层C++代码
- debug tensorflow的seq2seq的attention_decoder方法
- 如何在tensorflow中屏蔽Debug信息
- 页面载入进入后台,回来刷新,且只刷新一次,避免无限刷新
- SLAMTEC rplidar a1的使用
- jvm调优
- 将列表导出为excel表格
- 极光推送源码api封装改造
- TensorFlow发布Eager,便于Debug!
- Android组件学习笔记(简单音乐播放器,service与intent)
- ADO 数据库编程
- Java核心技术-反射
- Java时间处理类SimpleDateFormat的parse和format
- leetcode: 62. Unique Paths
- window7下部署zookeeper、启动dubbo-admin
- leetcode: 63. Unique Paths II
- Shiro (五) Base64和Md5加密