Tensorflow 图中的张量名称列表 [英] List of tensor names in graph in Tensorflow

查看:40
本文介绍了Tensorflow 图中的张量名称列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tensorflow 中的图形对象有一个方法叫做get_tensor_by_name(name)".无论如何可以获得有效张量名称的列表?

The graph object in Tensorflow has a method called "get_tensor_by_name(name)". Is there anyway to get a list of valid tensor names?

如果没有,有没有人知道预训练模型 inception-v3 的有效名称 来自这里?在他们的示例中,pool_3 是一个有效的张量,但列出所有张量会很好.我查看了引用的论文,有些层似乎与表 1 中的尺寸相对应,但并非全部.

If not, does anyone know the valid names for the pretrained model inception-v3 from here? From their example, pool_3, is one valid tensor but a list of all of them would be nice. I looked at the paper referred to and some of the layers seems to correspond to the sizes in table 1 but not all of them.

推荐答案

论文没有准确反映模型.如果你从 arxiv 下载源代码,它有一个准确的模型描述,如 model.txt,其中的名称与发布的模型中的名称密切相关.

The paper is not accurately reflecting the model. If you download the source from arxiv it has an accurate model description as model.txt, and the names in there correlate strongly with the names in the released model.

为了回答您的第一个问题,sess.graph.get_operations() 为您提供了一个操作列表.对于操作,op.name 为您提供名称,op.values() 为您提供它生成的张量列表(在 inception-v3 模型中,所有张量名称是附加了:0"的操作名称,所以 pool_3:0 是最终池操作产生的张量.)

To answer your first question, sess.graph.get_operations() gives you a list of operations. For an op, op.name gives you the name and op.values() gives you a list of tensors it produces (in the inception-v3 model, all tensor names are the op name with a ":0" appended to it, so pool_3:0 is the tensor produced by the final pooling op.)

这篇关于Tensorflow 图中的张量名称列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆