gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 21:08:44 27 4
gpt4 key购买 nike

我正在使用 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com