tensorflow - 如何获得与 TF 中隐藏层相关的权重?
问题描述
我需要提取模型中每个隐藏层的权重。
我尝试使用 tf.get_variable 但遇到错误。
#hidden layer 1
h1= tf.layers.dense(x,1024, kernel_initializer="he_normal", activation = "relu")
#get weights
with tf.variable_scope("h1", reuse=tf.True):
weights_h1 = tf.get_variable("kernel")
这是我得到的错误:
ValueError: Variable h1/kernel does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?
解决方案
推荐阅读
- python - 给定二维列表和值库的所有值的加权平均值
- cookies - 什么是“SL_wptGlobTipTmp”和“SL_GWPT_Show_Hide_tmp”cookie?
- javascript - 如何在 wordpress 中使用 out 插件创建浏览器推送导航
- office365 - 具有 Office 365 开发人员帐户的 Power BI Pro 许可证
- java - 抽象类和子类的构造函数注入
- qt - 未找到 QML 模块
- windows - 批量 Powershell 用户 csv 导入和主文件夹创建
- python - 线程 StompReceiverThread-1 中的异常
- python - Python无法通过从另一个python脚本导入函数的子进程执行子python脚本
- codenameone - 代号一 - 溢出菜单的样式边框