LAA : random fourier features的又一应用

        在论文NFormer: Robust Person Re-identification with Neighbor Transformer中的Landmark Agent Attention是对random fourier features 随机傅里叶特征 的又一在attention 降维上的应用:

        与测量高维表示向量之间的相似性不同,我们提出了一种更有效的方法来获得近似的亲和矩阵A。其关键思想是将高维表示向量z映射到低维编码空间,从而使等式(3)中的亲和性计算更加高效,这是受随机傅里叶特征启发的:
在这里插入图片描述

在这里插入图片描述

        方形的水平方向为矩阵的第一维度,数值方向为第二维度。(The horizontal side of the rectangles indicates the first dimension of the according matrices, while the vertical side indicates the second dimension. )

        输入由 z ∈ R N × d z ∈ R^{N×d} zRN×d表示, the query, key and value 矩阵 q , k , v ∈ R N × d q, k, v ∈ R^{ N×d} q,k,vRN×d 由线性映射生成. “原有代表”(landmark agents) z l ∈ R N × l z_l ∈ R^{N×l} zlRN×l are sampled from z to map the q, k of d-dimension to qe, ke of l-dimension.

        Then the approximate affinity matrix A ~ \widetilde A A is obtained by the multiplication of qe and ke. In this way, the time complexity of obtaining the affinity matrix reduces from O(N 2d) to O(N 2l), since the l is much smaller than d in practice. Then, the RNS is applied to A ~ \widetilde A A and turns the affinities into sparse attention weights. The final output u is obtained by weighted aggregation of value matrix v.

注:以上提到的RNS(reciprocal  neighbour softmax)等更多信息详见原论文。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值