Transformer
简介
Transformer是Google在
架构
Encoder输入
输入X有两种形式:
- 行向量:
- 列向量:
词嵌入
词嵌入(Word Embed)是将输入的token转换为高维的向量,从而将token的不同语义映射到高维空间的点,为后续的机器学习处理做基础。
位置编码
多头注意力
FFN
参考
- https://zhuanlan.zhihu.com/p/454482273
- https://github.com/datawhalechina/learn-nlp-with-transformers/blob/main/docs/%E7%AF%87%E7%AB%A02-Transformer%E7%9B%B8%E5%85%B3%E5%8E%9F%E7%90%86/2.2-%E5%9B%BE%E8%A7%A3transformer.md
- https://www.cnblogs.com/chenhuabin/p/16453665.html
- https://skylyj.github.io/transformer/