文章预览
↑ 点击 蓝字 关注极市平台 作 者丨BBuf 来源丨GiantPandaCV 编辑丨极市平台 极市导读 本文主要是对Linear Transformer的核心组件Linear Attention进行了原理讲解,并对实现Linear Attention组件的forward cuda kernel进行了详细解析。 >> 加入极市CV技术交流群,走在计算机视觉的最前沿 欢迎来 https://github.com/BBuf/how-to-optim-algorithm-in-cuda 踩一踩。 0x0. 问题引入 Linear Attention的论文如下: Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention: https://arxiv.org/pdf/2006.16236.pdf 。官方给出实现代码地址: https://github.com/idiap/fast-transformers 。虽然这个仓库是Linear Attention的原始实现,但基于这个codebase也引出了后续的一系列线性Attention的工作比如:Efficient Attention: Attention with Linear Complexities ( https://arxiv.org/abs/1812.01243 ), Linformer: SelfAttention with Linear Complexity( https://arxiv.org/abs/2006
………………………………