知识卡片
注意力伪代码要校准轴
书中代码图将Softmax写在缩放前且使用dim=0。对二维N×N分数矩阵,应先除√m,再沿键轴即最后一维归一化,随后乘V。还需明确QKV投影、输出投影、初始分块及LayerNorm的形状;nn等接口属于示意代码,本笔记未运行。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Pseudocode for this a ViT (with single-headed attention) is given below: The output of a transformer, as we have so far defined it, is a set of tokens Tout. Often we want an output of a different format, such as a single vector of logits for image classification (section 9.7.3), or in the format of an image for image-to-image tasks (section 34.6). To handle these
参考来源
- 位置:《Foundations of Computer Vision (Antonio Torralba, Phillip Isola etc.)》第26章《Transformer》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Foundations of Computer Vision (Antonio Torralba, Phillip Isola etc.)/_epub-src/OPS/xhtml/c026.xhtml)
- 结论依据:摘录中关于注意力伪代码要校准轴的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Pseudocode for this a ViT (with single-headed attention) is given below: The output of a transformer, as we have so far defined it, is a set of tokens Tout. Often we want an output of a different format, such as a single vector of logits for image classification (section 9.7.3), or in the format of an image for image-to-image tasks (section 34.6). To handle these