首页 > 其他 > 详细

Attension Is All You Need

时间:2021-08-16 22:39:50      阅读:15      评论:0      收藏:0      [点我收藏+]

attention机制将整个句子作为输入,从中抽取有用的信息。

每个输出都跟整个句子优化,输出的值为输入的句子的词向量的一个加权求和值。

 

“This is what attention does, it extracts information from the whole sequence, a weighted sum of all the past encoder states”

https://towardsdatascience.com/attention-is-all-you-need-discovering-the-transformer-paper-73e5ff5e0634

 

https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/

self-attention:

Self-attention is a sequence-to-sequence operation: a sequence of vectors goes in, and a sequence of vectors comes out. Let’s call the input vectors x1x2,…, xt and the corresponding output vectors y1y2,…, yt. The vectors all have dimension k. To produce output vector yi, the self attention operation simply takes a weighted average over all the input vectors, the simplest option is the dot product.

 

Q, K, V:

Every input vector is used in three different ways in the self-attention mechanism: the Query, the Key and the Value. In every role, it is compared to the other vectors to get its own output yi(Query), to get the j-th output yj(Key) and to compute each output vector once the weights have been established (Value).

 

Attension Is All You Need

原文:https://www.cnblogs.com/simpleminds/p/15149390.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!