Algorithm 17 of the Supplementary Information to Jumper et al. (2021),
p. 21. For each residue pair the pair representation queries the stack
of template features at that same pair, and the templates are pooled by
attention. The attention runs over templates only, never across pairs,
which is why it is pointwise: pair ij never sees pair kl.
Examples
set.seed(7)
n <- 3; nt <- 2; ct <- 4; cz <- 4; c <- 2
t <- array(rnorm(nt * n * n * ct), c(nt, n, n, ct))
z <- array(rnorm(n * n * cz), c(n, n, cz))
wq <- list(matrix(rnorm(c * cz), c, cz))
wk <- list(matrix(rnorm(c * ct), c, ct)); wv <- list(matrix(rnorm(c * ct), c, ct))
wo <- matrix(rnorm(cz * c), cz, c)
dim(Alftmpl(t, z, wq, wk, wv, wo)$z)
#> [1] 3 3 4
