Interpretable multi-head attention layer
layer_interpretable_mh_attention.Rd
Interpretable multi-head attention layer
References
B. Lim, S.O. Arik, N. Loeff, T. Pfiste, Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting(2020)
Examples
lookback <- 28
horizon <- 14
all_steps <- lookback + horizon
state_size <- 5
queries <- layer_input(c(horizon, state_size))
keys <- layer_input(c(all_steps, state_size))
values <- layer_input(c(all_steps, state_size))
imh_attention <-
layer_interpretable_mh_attention(
state_size = state_size, num_heads = 10
)(queries, keys, values)