Tensorflow timeline trace
根据
https://github.com/tensorflow/tensorflow/issues/1824
简单进行了测试
修改运行的脚本增加如下关键代码
例如mnist_softmax.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function # Import data from tensorflow.examples.tutorials.mnist import input_data from tensorflow.python.client import timeline import tensorflow as tf flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_string( 'data_dir' , '/tmp/data/' , 'Directory for storing data' ) mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot = True ) # Create the model x = 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 optimizer y_ = 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) # Train intiOp = tf.initialize_all_variables() # Init run_metadata run_metadata = tf.RunMetadata() # Open file to save trace trace_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 model correct_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})) #timeline trace = 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 ...
随机推荐
- 爬虫请求库——selenium
selenium模块 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requests无法直接执行JavaScript代码的问题.selenium的缺点是效率会变得很慢. sel ...
- what's the python之字符编码与文件处理
用文本编辑器打开一个文件就是把一个文件读入了内存中 ,所以打开文件的操作也是在内存中的,断电即消失,所以若要保存其内容就必须点击保存让其存入硬盘中 python解释器执行py文件的原理 : 第一阶段: ...
- vue-自定义pc端键盘-动画
<template> <div class="keyboard"> <div class="keyboard_key"> & ...
- linux中cmake语法的学习
在linux 下进行开发很多人选择编写makefile 文件进行项目环境搭建,而makefile 文件依赖关系复杂,工作量很大,搞的人头很大.常常,写代码,效率才是王道.这里还有自动化的项目构建工具C ...
- tp5Auth权限实现
原文地址:https://blog.csdn.net/qq_33257081/article/details/79137190 下面本人为大家讲解一下如何实现auth权限, 第一步,新建Auth.ph ...
- GOROOT、GOPATH、GOBIN
GOROOT golang安装路径. GOPATH GOPATH可以设置多个工程目录,linux下用冒号分隔(必须用冒号,fish shell的空格分割会出错),windows下用分号分隔,但是go ...
- element ui table 导出excel表格
https://blog.csdn.net/u010427666/article/details/79208145 vue2.0 + element UI 中 el-table 数据导出Excel1. ...
- element后太侧边
$router 是已经在ruterJs里面定义好的路由 以及组件 然后取值赋予进去就是了.但是真正的写法应该是 这样,, 执行点击事件的时候直接让跟换路由., 让后面 router-view 里面路由 ...
- [转]sqlserver2014两台不同服务器上数据库同步
https://www.cnblogs.com/peng0731/p/7359465.html 同步了快一个月了,因为途中比较麻烦,第一次,遇到烦的地方就停下了,今天终于同步成功了,哈哈,下面我就来介 ...
- java多线程小题一瞥
有如下线程类定义: public class MyThread extends Thread { private static int num = 0; public MyThread() { num ...