首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么注意解码器的输出需要与注意相结合?

为什么注意解码器的输出需要与注意相结合?
EN

Stack Overflow用户
提问于 2017-08-11 08:45:15
回答 1查看 320关注 0票数 0

tensorflow中的seq2seq

代码语言:javascript
复制
x = linear([inp] + attns, input_size, True)
# Run the RNN.
cell_output, state = cell(x, state)
# Run the attention mechanism.
if i == 0 and initial_state_attention:
  with variable_scope.variable_scope(variable_scope.get_variable_scope(), reuse=True):
    attns = attention(state)
else:
  attns = attention(state)
with variable_scope.variable_scope("AttnOutputProjection"):
  output = linear([cell_output] + attns, output_size, True)

我的问题是,为什么我们需要将cell_output与as结合起来,而不是仅仅使用cell_output作为输出?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-11 08:54:02

注意机制需要将更多的注意力放在某些特殊或特定的节点上。

这里,cell_output是数学中的一个矩阵。以及深度学习中节点的表示或组合。

因此,最后,如果您想给一些数据更多的优先级,那么您必须对您的cell_output进行一些更改。也就是说,我们是通过对原始矩阵(cell_output)进行一些级联、加法或点积运算来实现的。

代码语言:javascript
复制
let x = 5
and you want to make x = 7
then you can do x = x + 2(one way).
so that means you have make changes to your x variable. 
same operation you are doing to apply attention to your hidden layers nodes or in your case cell_output. 
here x is cell_output and 2 is attention output.

如果您不对您的cell_output进行任何更改,那么您为什么要将注意力添加到您的输出表示上!

您可以直接将cell_output传递到最终层,而无需与注意矩阵相结合,也不需要应用注意。但是你需要知道为什么神经网络需要注意机制!

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

https://stackoverflow.com/questions/45630736

复制
相关文章

相似问题

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