#tf.Session.run也接收一个可选的参数options
#能够让你来配置训练时的参数
#run_metadata参数让你能够收集关于训练的元信息
#列如你可以使用这些可选项来追踪执行的信息
import tensorflow as tf
y = tf.matmul([[37.0, -23.0], [1.0, 4.0]], tf.random_uniform([2, 2]))
with tf.Session() as sess:
# Define options for the sess.run() call
options = tf.RunOptions()
options.output_partition_graphs = True
options.trace_level = tf.RunOptions.FULL_TRACE # Define a container for the returned metadata
metadata = tf.RunMetadata() sess.run(y, options=options, run_metadata=metadata) # Print the subgraphs that executed on each device
print(metadata.partition_graphs) # Print the timings of each operation that executed
print(metadata.step_stats)

下面是输出的结果:

2018-02-17 11:12:58.518912: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
[node {
name: "MatMul/a"
op: "Const"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 2
}
dim {
size: 2
}
}
tensor_content: "\000\000\024B\000\000\270\301\000\000\200?\000\000\200@"
}
}
}
}
node {
name: "random_uniform/shape"
op: "Const"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "dtype"
value {
type: DT_INT32
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_INT32
tensor_shape {
dim {
size: 2
}
}
tensor_content: "\002\000\000\000\002\000\000\000"
}
}
}
}
node {
name: "random_uniform/RandomUniform"
op: "RandomUniform"
input: "random_uniform/shape"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "T"
value {
type: DT_INT32
}
}
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "seed"
value {
i: 0
}
}
attr {
key: "seed2"
value {
i: 0
}
}
}
node {
name: "random_uniform/sub"
op: "Const"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_FLOAT
tensor_shape {
}
tensor_content: "\000\000\200?"
}
}
}
}
node {
name: "random_uniform/mul"
op: "Mul"
input: "random_uniform/RandomUniform"
input: "random_uniform/sub"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
}
node {
name: "random_uniform/min"
op: "Const"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_FLOAT
tensor_shape {
}
float_val: 0.0
}
}
}
}
node {
name: "random_uniform"
op: "Add"
input: "random_uniform/mul"
input: "random_uniform/min"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
}
node {
name: "MatMul"
op: "MatMul"
input: "MatMul/a"
input: "random_uniform"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
attr {
key: "transpose_a"
value {
b: false
}
}
attr {
key: "transpose_b"
value {
b: false
}
}
}
node {
name: "_retval_MatMul_0_0"
op: "_Retval"
input: "MatMul"
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
attr {
key: "index"
value {
i: 0
}
}
}
library {
}
versions {
producer: 24
}
]
dev_stats {
device: "/job:localhost/replica:0/task:0/device:CPU:0"
node_stats {
node_name: "_SOURCE"
all_start_micros: 1518837178526738
op_start_rel_micros: 12
op_end_rel_micros: 12
all_end_rel_micros: 21
memory {
allocator_name: "cpu"
}
timeline_label: "_SOURCE = NoOp()"
scheduled_micros: 1518837178526691
memory_stats {
}
}
node_stats {
node_name: "MatMul/a"
all_start_micros: 1518837178526765
op_end_rel_micros: 5
all_end_rel_micros: 7
memory {
allocator_name: "cpu"
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
dim {
size: 2
}
dim {
size: 2
}
}
allocation_description {
requested_bytes: 16
allocator_name: "cpu"
ptr: 1903518068800
}
}
}
timeline_label: "MatMul/a = Const()"
scheduled_micros: 1518837178526759
memory_stats {
host_persistent_memory_size: 16
host_persistent_tensor_alloc_ids: -1
}
}
node_stats {
node_name: "random_uniform/shape"
all_start_micros: 1518837178526773
op_start_rel_micros: 1
op_end_rel_micros: 2
all_end_rel_micros: 2
memory {
allocator_name: "cpu"
}
output {
tensor_description {
dtype: DT_INT32
shape {
dim {
size: 2
}
}
allocation_description {
requested_bytes: 8
allocator_name: "cpu"
ptr: 1903518066368
}
}
}
timeline_label: "random_uniform/shape = Const()"
scheduled_micros: 1518837178526772
memory_stats {
host_persistent_memory_size: 8
host_persistent_tensor_alloc_ids: -1
}
}
node_stats {
node_name: "random_uniform/sub"
all_start_micros: 1518837178526780
op_end_rel_micros: 1
all_end_rel_micros: 1
memory {
allocator_name: "cpu"
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
}
allocation_description {
requested_bytes: 4
allocator_name: "cpu"
ptr: 1903518066240
}
}
}
timeline_label: "random_uniform/sub = Const()"
scheduled_micros: 1518837178526775
memory_stats {
host_persistent_memory_size: 4
host_persistent_tensor_alloc_ids: -1
}
}
node_stats {
node_name: "random_uniform/min"
all_start_micros: 1518837178526782
op_end_rel_micros: 1
all_end_rel_micros: 2
memory {
allocator_name: "cpu"
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
}
allocation_description {
requested_bytes: 4
allocator_name: "cpu"
ptr: 1903518069120
}
}
}
timeline_label: "random_uniform/min = Const()"
scheduled_micros: 1518837178526781
memory_stats {
host_persistent_memory_size: 4
host_persistent_tensor_alloc_ids: -1
}
}
node_stats {
node_name: "random_uniform/RandomUniform"
all_start_micros: 1518837178526785
op_start_rel_micros: 1
op_end_rel_micros: 11
all_end_rel_micros: 12
memory {
allocator_name: "cpu"
total_bytes: 16
peak_bytes: 16
live_bytes: 16
allocation_records {
alloc_micros: 1518837178526792
alloc_bytes: 16
}
allocation_records {
alloc_micros: 1518837178526870
alloc_bytes: -16
}
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
dim {
size: 2
}
dim {
size: 2
}
}
allocation_description {
requested_bytes: 16
allocated_bytes: 16
allocator_name: "cpu"
allocation_id: 1
has_single_reference: true
ptr: 1903518118336
}
}
}
timeline_label: "random_uniform/RandomUniform = RandomUniform(random_uniform/shape)"
scheduled_micros: 1518837178526776
memory_stats {
}
}
node_stats {
node_name: "random_uniform/mul"
all_start_micros: 1518837178526798
op_start_rel_micros: 1
op_end_rel_micros: 11
all_end_rel_micros: 12
memory {
allocator_name: "cpu"
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
dim {
size: 2
}
dim {
size: 2
}
}
allocation_description {
requested_bytes: 16
allocated_bytes: 16
allocator_name: "cpu"
allocation_id: 1
ptr: 1903518118336
}
}
}
timeline_label: "random_uniform/mul = Mul(random_uniform/RandomUniform, random_uniform/sub)"
scheduled_micros: 1518837178526797
memory_stats {
}
}
node_stats {
node_name: "random_uniform"
all_start_micros: 1518837178526812
op_end_rel_micros: 8
all_end_rel_micros: 9
memory {
allocator_name: "cpu"
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
dim {
size: 2
}
dim {
size: 2
}
}
allocation_description {
requested_bytes: 16
allocated_bytes: 16
allocator_name: "cpu"
allocation_id: 1
ptr: 1903518118336
}
}
}
timeline_label: "random_uniform = Add(random_uniform/mul, random_uniform/min)"
scheduled_micros: 1518837178526810
memory_stats {
}
}
node_stats {
node_name: "MatMul"
all_start_micros: 1518837178526823
op_end_rel_micros: 45
all_end_rel_micros: 47
memory {
allocator_name: "cpu"
total_bytes: 16
peak_bytes: 16
live_bytes: 16
allocation_records {
alloc_micros: 1518837178526826
alloc_bytes: 16
}
}
output {
tensor_description {
dtype: DT_FLOAT
shape {
dim {
size: 2
}
dim {
size: 2
}
}
allocation_description {
requested_bytes: 16
allocated_bytes: 16
allocator_name: "cpu"
allocation_id: 1
has_single_reference: true
ptr: 1903518061312
}
}
}
timeline_label: "MatMul = MatMul(MatMul/a, random_uniform)"
scheduled_micros: 1518837178526821
memory_stats {
}
}
node_stats {
node_name: "_retval_MatMul_0_0"
all_start_micros: 1518837178526872
op_start_rel_micros: 1
op_end_rel_micros: 3
all_end_rel_micros: 5
memory {
allocator_name: "cpu"
}
timeline_label: "_retval_MatMul_0_0 = _Retval(MatMul)"
scheduled_micros: 1518837178526870
memory_stats {
}
}
}

最新文章

  1. C# 获取 oracle 存储过程的 返回值
  2. popupwindow与软键盘的问题
  3. Linux下的字符集问题
  4. Spark小课堂Week6 启动日志详解
  5. 转载:STM32之中断与事件---中断与事件的区别
  6. css01入门小例子
  7. WEBGL 2D游戏引擎研发系列 第一章 <新的开始>
  8. jsp 分页(数据库读取数据)
  9. iOS crash日志分析
  10. svn 集成 redmine 账户验证的终极解决方案
  11. 版本控制工具(SVN/Git)介绍
  12. mysql 原理 ~ 并行复制
  13. mysql 5.7 ERROR 1054(42S22) Unknown column 'password' in ‘field list’ 报错
  14. Oracle11g温习-第十二章:tables
  15. opencv 对RGB图像直接二值化
  16. CentOS7防火墙fiewall用法
  17. 键盘对应数字-keycode值大全(转)
  18. SAP Odata実行命令(1)
  19. 【BZOJ4837】LRU算法 [模拟]
  20. 手把手教你用Vue2+webpack+node开发一个H5 app

热门文章

  1. 使用xmake优雅地描述工程
  2. chineseocr项目的配置阶段出现的问题及解决方案
  3. [Python3 填坑] 003 关键字?保留字?预留字?
  4. HDU-1878 欧拉回路(并查集,欧拉回路性质)
  5. JavaScript 模块化简析
  6. Vue.js——60分钟快速入门 一
  7. linux学习笔记(1):
  8. 如何判断当前LINUX系统启用了ASLR
  9. python3 使用 django-xadmin 遇到的许多坑
  10. 如何在centos7中设置redis服务器开机自启动