Attention, residual, normalisation, feed-forward, residual,
normalisation, with batch normalisation by default.
Usage
morie_gtrf_layer(H, adj, WQ, WK, WV, W1, W2, edge_bias = NULL, norm = "batch")
Arguments
- H
Node feature matrix (n x d).
- adj
Adjacency list.
- WQ, WK, WV
Attention projections.
- W1, W2
Feed-forward projections.
- edge_bias
Optional per-pair scalar biases.
- norm
"batch", "layer" or "none".
Value
New node feature matrix.
References
Dwivedi, V. P. and Bresson, X. (2020).
Examples
set.seed(14)
H <- matrix(rnorm(8), 4, 2)
adj <- list(`0` = 1L, `1` = c(0L, 2L), `2` = c(1L, 3L), `3` = 2L) # 0-based node ids
I2 <- diag(2)
dim(morie_gtrf_layer(H, adj, I2, I2, I2, I2, I2, norm = "layer"))
#> [1] 4 2