#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 {
}
}
}

128、TensorFlow元数据MetaData的更多相关文章

  1. WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[扩展篇]

    原文:WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[扩展篇] 通过<实现篇>对WSDL元素和终结点三要素的之间的匹配关系的介绍,我们知道了WSDL的Binding ...

  2. WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[实现篇]

    原文:WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[实现篇] 元数据的导出就是实现从ServiceEndpoint对象向MetadataSet对象转换的过程,在WCF元数据框 ...

  3. 数据库元数据MetaData

    本篇介绍数据库方面的元数据(MetaData)的有关知识.元数据在建立框架和架构方面是特别重要的知识,再下一篇我们仿造开源数据库工具类DbUtils就要使用数据库的元数据来创建自定义JDBC框架. 在 ...

  4. 【收藏】关于元数据(Metadata)和元数据管理,这是我的见过最全的解读!

    本文主要从元数据的定义.作用.元数据管理现状.管理标准和元数据管理功能等方面讲述了我对元数据(Metadata)和元数据管理的认知及理解. 元数据管理 一.元数据的定义 按照传统的定义,元数据(Met ...

  5. 元数据metadata 对IO有多大影响

    日志文件系统(journaling file systems)可防止系统崩溃时导致的数据不一致问题.对文件系统元数据(metadata)的更改都被保存在一份单独的日志里,当发生 系统崩溃时可以根据日志 ...

  6. 元数据(meta-data)

    本章所介绍的元数据的知识,可能在定制系统时会用到.因为那是后需要修改底层框架的一些内容 一.元数据的定义 在AndroidManifest.xml中如下书写: <activity android ...

  7. 元数据Metadata

    元数据是什么? 元数据(Metadata),又称中介数据.中继数据,为描述数据的数据(data about data),主要是描述数据属性(property)的信息,用来支持如指示存储位置.历史数据. ...

  8. 元数据MetaData(五)

    JDBC的元数据接口有: DatabaseMetaData数据库级 ResultSetMetaData结果集级 一.DatabaseMetaData 在对数据源进行连接以后,得到一个Connectio ...

  9. Android MediaMetadataRetriever 读取多媒体文件信息,元数据(MetaData)

    音乐播放器通常需要获取歌曲的专辑.作者.标题.年代等信息,将这些信息显示到UI界面上. 1.一种方式:解析媒体文件   命名空间:android.media.MediaMetadataRetrieve ...

随机推荐

  1. python基础-10 程序目录结构 学生选课系统面向对象练习

    一 程序目录结构 1 bin文件夹 二进制文件.代码程序  2 conf 配置文件  3 帮助文档  4 头文件库文件等 二 学生选课系统部分代码 未完待续 1 包内的__init__.py文件 在包 ...

  2. [Git] 001 初识 Git 与 GitHub 之新建仓库

    在 GitHub 的 UI 界面使用 Git 新建一个仓库 1. 点击右上角的 +,选择 New repository 2. 网站会自动跳转至新页面,在下框中填入仓库名 仓库名也有讲究,挖个坑,日后填 ...

  3. SpringMvc+Mybatis开发调用存储过程

    <mapper namespace="com.jkw100.ssm.mapper.CustomerMapperCustom" > <!-- statementTy ...

  4. Nginx负载均衡的max_fails和fail_timeout的默认配置问题

    今天发现一个奇怪的现象,前端请求后端服务多次后会超时一次,经过多次验证确定是大概10s左右就会超时一次,检查后端服务,发现其中一个节点已经夯死. 但是我们的nginx负载均衡策略是轮询机制,按照配置来 ...

  5. Codeforces 1058C(思维+最大公因数)

    题面 传送门 分析 引理1:三角形的面积\(\times 2\)一定是整数 由坐标系中的三角形面积公式 \[S=\frac{1}{2}(x_1y_2+x_2y_3+x_3y_1-x_1y_3-x_2y ...

  6. 面向切面编程 AOP 和装饰器??

    1.AOP概念:面向切面编程,指扩展功能不修改源代码,将功能代码从业务逻辑代码中分离出来. 主要功能:日志记录,性能统计,安全控制,事务处理,异常处理等等. 主要意图:将日志记录,性能统计,安全控制, ...

  7. 最全的 Java 知识总结- Github 日增 10 star

    项目地址: 如果觉得有帮助,希望大家给个 star 鼓励以下:同时也希望大家多多 fork,一起加入进来. 为什么选择做这个开源项目 首先,希望提高自己:因为选择做这个,自己肯定就会花时间去提高自己的 ...

  8. asp.net中的<% %>,<%= %>,<%# %><%$ %>的使用

    原文:https://www.cnblogs.com/Hackerman/p/3857630.html 首先我们来看一下<% %>的使用 在aspx的页面中只能使用服务器控件和一般的控件, ...

  9. 【汇总目录】eShopOnContainers

    随笔分类 - eShopOnContainers eShopOnContainers 知多少[10]:部署到 K8S | AKS 摘要:1. 引言 断断续续,感觉这个系列又要半途而废了.趁着假期,赶紧 ...

  10. ActiveMQ的介绍及使用

    一.消息中间件概述 什么是消息中间件 发送者将消息发送给消息服务器,消息服务器将消感存放在若千队列中,在合适的时候再将消息转发给接收者. 这种模式下,发送和接收是异步的,发送者无需等待; 二者的生命周 ...