python - 在 Tensorflow 中,获取图中所有张量的名称

标签 python tensorflow tensorboard skflow

我正在使用 Tensorflowskflow 创建神经网络;出于某种原因,我想获取给定输入的一些内部张量的值,所以我使用 myClassifier.get_layer_value(input, "tensorName"), myClassifier 作为skflow.estimators.TensorFlowEstimator

但是,我发现很难找到张量名称的正确语法,即使知道它的名称(而且我对运算和张量感到困惑),所以我使用 tensorboard 来绘制图形并查找名字。

有没有办法在不使用张量板的情况下枚举图中的所有张量?

最佳答案

你可以的

[n.name for n in tf.get_default_graph().as_graph_def().node]

另外,如果您在 IPython 笔记本中进行原型(prototype)设计,您可以直接在笔记本中显示图形,请参阅 Alexander's Deep Dream notebook 中的 show_graph 函数

关于python - 在 Tensorflow 中,获取图中所有张量的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36883949/

相关文章:

python - Tensorflow Keras实现多实例学习问题

python - 构建 Keras 项目以在 GPU 中实现可重现的结果

来自嵌套字典的 Python 数据类

python - 使用堆栈通过单列索引多列

tensorflow - 在 Google ML 中创建大型模型版本失败

python - Tensorboard 损失图可以追溯到过去 (Keras)

azure - Azure 虚拟机上无法访问 TensorBoard

tensorflow - TensorBoard:如何编写图像以获得步长 slider ?

python subprocess.popen 进入无限循环

python - 如何在Python中的数据框中索引列表元素?