quantlab.model.predefined.master.TemporalAttention#

class quantlab.model.predefined.master.TemporalAttention(d_model)[source]#

Bases: Module

Aggregates a symbol’s N steps with weights softmax_t((W z_t)·(W z_N)).

Examples

>>> TemporalAttention(8)(torch.randn(5, 3, 8)).shape
torch.Size([5, 8])
forward(z)[source]#

Map [S_t, N, D] to [S_t, D].

Examples

>>> TemporalAttention(8).forward(torch.randn(3, 4, 8)).shape
torch.Size([3, 8])