# Create the Timeline object, and write it to a json
from tensorflow.python.client import timeline
tl = timeline.Timeline(run_metadata.step_stats)
ctf = tl.generate_chrome_trace_format()
with tf.gfile.GFile("timeline.json", 'w') as f:
f.write(ctf)

chrome://tracing/

from tensorflow.core.framework import graph_pb2
from tensorflow.python.profiler import model_analyzer
from tensorflow.python.profiler import option_builder graph = tf.Graph()
with graph.as_default():
graph_def = graph_pb2.GraphDef()
with open(args.input_graph, "rb") as f:
graph_def.ParseFromString(f.read())
_ = tf.import_graph_def(graph_def, name='')
config = tf.ConfigProto(inter_op_parallelism_threads=args.num_inter_threads, intra_op_parallelism_threads=args.num_intra_threads)
with tf.Session(config=config, graph=graph) as sess: # warm up
... # benchmark
... # profiling
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
profiler = model_analyzer.Profiler(graph=graph) for i in range(10):
outputs = sess.run(output_data, feed_dict=input_data, options=run_options, run_metadata=run_metadata)
profiler.add_step(step=i, run_meta=run_metadata) profile_op_opt_builder = option_builder.ProfileOptionBuilder()
profile_op_opt_builder.select(['micros','occurrence'])
profile_op_opt_builder.order_by('micros')
profile_op_opt_builder.with_max_depth(50)
profiler.profile_operations(profile_op_opt_builder.build())

最新文章

  1. Java基础学习(四)
  2. Python-13-堡垒机开发
  3. hdu1150 匈牙利
  4. CSS,bootstrap表格控制当td内容过长时用省略号表示,以及在不使用bootstrap时过长也用省略号表示
  5. java文件中文在MyEclipse中打开变成了乱码
  6. jdbc事务
  7. js获取后台json数据显示在jsp页面元素
  8. linux sigaction信号处理
  9. VB.NET中网络编程的另一种方案----system.net中的HttpWebRequest类的使用
  10. 19条MySQL优化准则
  11. headfirst设计模式(5)—工厂模式体系分析及抽象工厂模式
  12. 细说@Html.ActionLink()的用法
  13. linux用户和组管理,/etc/passwd 、/etc/shadow和/etc/group --学习
  14. Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name
  15. 《高性能MySQL》——第一章MySQL的架构与历史
  16. 浅谈python中的“ ==” 与“ is”
  17. ntpdate设置
  18. .net core 2.0 mvc 获取配置信息
  19. 使用gettext提取c#中的多语言占位符(nopCommerce示例篇)
  20. PAT 乙级 1078 / 1084

热门文章

  1. Android内嵌网页webview点击其中的链接跳转到我们应用内的Activity
  2. [洛谷P5106]dkw的lcm:欧拉函数+容斥原理+扩展欧拉定理
  3. A - Biorhythms (第三周)
  4. httpscan 爬虫式的网段Web主机发现小工具
  5. 【洛谷P1983 车站分级】
  6. uid auid euid的区别
  7. java SimpleDateFormat setLenient用法
  8. PLSQL设置数据库选项
  9. python 正则表达式 re.split
  10. LeetCode 94. Binary Tree Inorder Traversal 动态演示