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 ...
随机推荐
- 使用 HTMLTestRunner 模块生成HTML格式的测试报告文件
1.下载HTMLTestRunner.py HTMLTestRunner 是 Python 标准库的 unittest 模块的一个扩展.它生成易于使用的 HTML 测试报告.HTMLTestRunne ...
- ATM_购物车作业
作业要求 模拟实现一个ATM + 购物商城程序 额度 15000或自定义 实现购物商城,买东西加入 购物车,调用信用卡接口结账 可以提现,手续费5% 支持多账户登录 支持账户间转账 记录每月日常消费流 ...
- [django]cbv方式
cbv的方式 1.简单的url from django.views.generic import TemplateView path('', TemplateView.as_view(template ...
- [LeetCode] 154. Find Minimum in Rotated Sorted Array II_Hard
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e. ...
- [LeetCode] 619. Biggest Single Number_Easy tag: SQL
Table number contains many numbers in column num including duplicated ones.Can you write a SQL query ...
- SDWebImage代码赏析
过NSOperationQueue来控制 为了保护变量,使用大量了sychronized 读的时候使用了dispatch_sync dispatch_sync(sself.barrierQueue, ...
- CentOS6.5安装sqlite3
1.下载安装包:https://www.sqlite.org/download.html 2.解压 [root@mycentos ~]# tar xzvf sqlite-snapshot-201809 ...
- TensorFlow读取CSV数据(批量)
直接上代码: # -*- coding:utf-8 -*- import tensorflow as tf def read_data(file_queue): reader = tf.TextLin ...
- Stacking调参总结
1. 回归 训练了两个回归器,GBDT和Xgboost,用这两个回归器做stacking 使用之前已经调好参的训练器 gbdt_nxf = GradientBoostingRegressor(lear ...
- iOS UI进阶-1.0 Quartz2D
概述 Quartz 2D是一个二维绘图引擎,同时支持iOS和Mac系统.Quartz 2D能完成的工作: 绘制图形 : 线条\三角形\矩形\圆\弧等 绘制文字 绘制\生成图片(图像) 读取\生成PDF ...