transformer模型核心图解

版权声明:本文为博主jmh原创文章,未经博主允许不得转载。 https://blog.csdn.net/jmh1996/article/details/86219625

三图解万言!!!

模型图:
在这里插入图片描述

在这里插入图片描述

动画:

在这里插入图片描述
首先输入源语:“I arrived at the ”
第一层 self-attention
然后第二层 self-attention,输入是上一层attention的结果
然后第三层 self-attention,输入是上一层的attention结果。
这样 见过三次多头attention后,得到输入句子的句法树。
完了Decoder是< start> 开始,拿它与encoder最后的输出进行attention,经过多次的attention得到输出。
第二个输出时,会把decoder上一步的输出也拿来一起attention.

猜你喜欢

转载自blog.csdn.net/jmh1996/article/details/86219625