debugging - 如何可视化 TensorFlow Estimator 权重?

标签 debugging machine-learning tensorflow visualization

如何从 tf.estimator.Estimator 中选择一个层并访问该层中每个单元的权重向量?具体来说,我正在尝试可视化密集层的权重。

查看https://github.com/tensorflow/tensorflow/blob/r1.3/tensorflow/python/layers/core.py似乎权重被称为内核,但在使用估计器抽象时我无法访问它们。

Ps:关于Estimator的实现示例,我们引用https://www.tensorflow.org/get_started/estimator

最佳答案

估算器 has a method称为get_variable_value。因此,一旦您生成了检查点(或从其中加载了变量值),并且如果您知道密集层的名称,则可以使用 matplotlib 执行类似的操作:

import matplotlib.pyplot as plt

weights = estimator.get_variable_value('dense/kernel')
plt.imshow(weights, cmap='gray')
plt.show()

关于debugging - 如何可视化 TensorFlow Estimator 权重?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45863744/

相关文章:

javascript - 如何将CasperJS调试结果打印到文本文件

python - Tensorflow:训练神经网络时损失没有改善

tensorflow - 我可以使用 TensorFlow 测量各个操作的执行时间吗?

tensorflow - 你如何在tensorflow中列出图中的变量?

debugging - lldb-错误 : invalid thread #i

c - 系统小程序 : Assertion failed - any ideas how to debug effectively?

python - tensorflow 线性回归的pytorch等价物是什么?

opencv - SVM图像目标大小问题

image - 在 Tensorflow 中调整图像保留纵横比

javascript - IE。一开始我的 JS 脚本崩溃了,然后我按 F12,它运行得很漂亮