
Triangular gated self-attention over the AlphaFold pair representation
Source:R/Alftriat.R
Alftriat.RdAlgorithms 13 and 14 of the Supplementary Information to Jumper et al.
(2021), pp. 19-20. Edge ij attends over the edges sharing its
starting node i or its ending node j. The attention logit
is a scaled query-key product modulated by a bias taken from the third
edge of the triangle, which is what makes it triangular rather than
ordinary attention.
Arguments
- z
Pair representation, an
n x n x czarray.- wq, wk, wv
Lists of per-head projection matrices, each
c x cz.- wb
Per-head bias projection,
nhead x cz(line 3).- wg
List of per-head gate projections, each
c x cz(line 4).- wo
Output projection,
cz x (nhead * c)(line 7).- mode
Either "starting" (Algorithm 13) or "ending" (Algorithm 14).