首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >关于tensorboard adam节点

关于tensorboard adam节点
EN

Stack Overflow用户
提问于 2017-04-11 20:14:01
回答 1查看 292关注 0票数 2

当我运行tensorboard时,我发现在我的权重中,例如‘variable_scope’,有两个adam节点,它们的名称是'weight/Adam‘和'weight/Adam_1',但是我不能在我的variable_scope 'weight’中定义它。是我的代码错了,还是adam算法自动在“weight”中添加了两个节点,以便建立控制依赖关系?

EN

回答 1

Stack Overflow用户

发布于 2019-02-28 04:45:12

因此,首先,这两个节点由您的AdamOptimizer添加,作为BP计算图中的节点。

然后,对于为什么有两个节点而不是一个节点的问题,尽管不了解幕后发生的事情,但这应该是正常情况。试试这个简单的代码片段:

代码语言:javascript
复制
import tensorflow as tf

x = tf.placeholder(shape=(None, 10), dtype=tf.float64)
W = tf.get_variable(shape=(10, 20), dtype=tf.float64, name="W")
y = tf.matmul(x, W)
opt = tf.train.AdamOptimizer(learning_rate=0.001, beta1=0.9, beta2=0.98, epsilon=1e-8)
y_true = tf.placeholder(shape=(None, 20), dtype=tf.float64)
loss = y_true - y
train_op = opt.minimize(loss)

for v in tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES):
    print(v)

这将为您提供以下内容:

代码语言:javascript
复制
<tf.Variable 'W:0' shape=(10, 20) dtype=float64_ref>
<tf.Variable 'beta1_power:0' shape=() dtype=float32_ref>
<tf.Variable 'beta2_power:0' shape=() dtype=float32_ref>
<tf.Variable 'W/Adam:0' shape=(10, 20) dtype=float64_ref>
<tf.Variable 'W/Adam_1:0' shape=(10, 20) dtype=float64_ref>

其中还创建了2个Adam节点

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43345609

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档