Tensorflow timeline trace
根据
https://github.com/tensorflow/tensorflow/issues/1824
简单进行了测试
修改运行的脚本增加如下关键代码
例如mnist_softmax.py
from __future__ import absolute_importfrom __future__ import divisionfrom __future__ import print_function# Import datafrom tensorflow.examples.tutorials.mnist import input_datafrom tensorflow.python.client import timelineimport tensorflow as tfflags = tf.app.flagsFLAGS = flags.FLAGSflags.DEFINE_string('data_dir', '/tmp/data/', 'Directory for storing data')mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True)# Create the modelx = tf.placeholder(tf.float32, [None, 784])W = tf.Variable(tf.zeros([784, 10]))b = tf.Variable(tf.zeros([10]))y = tf.nn.softmax(tf.matmul(x, W) + b)# Define loss and optimizery_ = tf.placeholder(tf.float32, [None, 10])cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)# TrainintiOp = tf.initialize_all_variables()# Init run_metadatarun_metadata = tf.RunMetadata()# Open file to save tracetrace_file = open('/tmp/timeline.ctf.json', 'w')sess = tf.Session()sess.run(intiOp)for i in range(500): batch_xs, batch_ys = mnist.train.next_batch(100) sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys}, options=tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE), run_metadata=run_metadata)# Test trained modelcorrect_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))print(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))#timelinetrace = timeline.Timeline(step_stats=run_metadata.step_stats)trace_file.write(trace.generate_chrome_trace_format()) |
打开chrome浏览器输入
选择Load按钮加载输出的json文件
W,S按键可以缩放,A,D按键可以移动,具体帮助点击右上角“?”按钮
Tensorflow timeline trace的更多相关文章
- caffe, caffe2, paddlepaddle, tensorflow对于cuda,cudnn,protobuf依赖的纠葛
由于在学习神经网络,为了尝试各种深度学习框架,电脑上目前安装了caffe, caffe2, paddlepaddle, tensorflow三款主流框架,但是安装过程中真是痛不欲生. 且不说单单安装一 ...
- web前端自动化测试/爬虫利器puppeteer介绍
web前端自动化测试/爬虫利器puppeteer介绍 Intro Chrome59(linux.macos). Chrome60(windows)之后,Chrome自带headless(无界面)模式很 ...
- puppeteer UI自动化测试demo(一)
一.简介 这个不大常见,比较常见的是selenium和weddriver: 所以就增加一个说明,来自官网的. Puppeteer 是一个 Node 库,它提供了一个高级 API 来通过 DevTool ...
- puppeteerExamples
What can I do? Most things that you can do manually in the browser can be done using Puppeteer! Here ...
- Puppeteer学习笔记 (1)- 什么是Puppeteer
本文链接:https://www.cnblogs.com/hchengmx/p/11006263.html 1. phantomjs介绍 在介绍puppeteer之前必须介绍一下phantomjs,p ...
- 学习笔记TF062:TensorFlow线性代数编译框架XLA
XLA(Accelerated Linear Algebra),线性代数领域专用编译器(demain-specific compiler),优化TensorFlow计算.即时(just-in-time ...
- Xperf Basics: Recording a Trace(转)
http://randomascii.wordpress.com/2011/08/18/xperf-basics-recording-a-trace/ This post is obsolete ...
- 双显卡笔记本安装CUDA+theano、tensorflow环境
原文出处:http://www.cnblogs.com/jacklu/p/6377820.html 个人知乎主页欢迎关注:https://www.zhihu.com/people/jack_lu,相信 ...
- TensorFlow anaconda命令备忘
[查看tensorflow安装的版本] anaconda search -t conda tensorflow [选择版本安装] conda install -c anaconda tensorflo ...
随机推荐
- Python3学习之路~6.5 私有属性和私有方法
属性分为静态属性和动态属性,静态属性就是变量,动态属性就是方法.但是一般我们说的属性就是变量,方法就是方法.私有属性/方法就是外面访问不了,只有自己能够访问的属性/方法.如何将属性和方法分别变成私有属 ...
- Linksys E 刷Tomato shibby
前言 一直以来都用Linksys的无线路由器~因为它的稳定~多年来一直用Linksys自身的固件~因为之前没用它做什么特别的应用~所以一直用了下来~它的原厂固件的稳定性也从没让我操过心~近来要为用户提 ...
- PS游戏摸拟器ePSXe加速游戏速度方法
1.启动ePSXe游戏摸拟器. 2.菜单栏上的设置->视频->在视频设置窗口 设置主视频插件->设置. 3.在设置插件的窗口帧速率选择框中 勾上使用帧速率限制 点选帧速率限制为(10 ...
- padStart()方法,padEnd()方法
https://blog.csdn.net/ixygj197875/article/details/79090578
- ES6的export与Nodejs的module.exports
原文:https://www.cnblogs.com/lxg0/p/7774094.html module.exports与exports,export与export default之间的关系和区别 ...
- 【Java】-NO.20.Exam.1.Java.1.001- 【1z0-807】- OCEA
1.0.0 Summary Tittle:[Java]-NO.20.Exam.1.Java.1.001-[1z0-807] Style:EBook Series:Java Since:2017-10- ...
- python 调用阿里云云解析api添加记录
首先安装阿里云SDK pip install aliyun-python-sdk-core pip install aliyun-python-sdk-alidns 可以配合jenkins传递参数 # ...
- 20个Java练手项目,献给嗜学如狂的人
给大家推荐一条由浅入深的JAVA学习路径,首先完成 Java基础.JDK.JDBC.正则表达式等基础实验,然后进阶到 J2SE 和 SSH 框架学习.最后再通过有趣的练手项目进行巩固. JAVA基础 ...
- 后续使用dubbo的必要性的思考
要做微服务,要做分布式,就得先解决网络调用即rpc的问题
- Java语言基础问题
1. 一个Java类文件中可以有几个公有类 在eclipse中测试代码时会出现上图所示的错误,此处只允许用final或abstract来修饰类,也就是一个类文件中只能有一个public修饰的类,此下对 ...