Word2Vec
Transformer
1.Self-Attetion
矩阵形式(每行表示一个单词)
2.Multiple Heads
结果拼接
整体计算过程
3.使用位置编码表示序列的顺序
位置编码和embedding相加作为输入
4.残差连接
5.decoder
The output of the top encoder is then transformed into a set of attention vectors K and V. These are to be used by each decoder in its “encoder-decoder attention” layer which helps the decoder focus on appropriate places in the input sequence
decoder中self-attention只允许关注之前的位置,通过在softmax前设置为-inf,mask后面的位置。
“Encoder-Decoder Attention” 也是multihead,除了计算下面输入的Q,也会计算顶层encoder的K和V。
6.Linear和Softmax
7.loss function