L-TAE#

class torchgeo.models.LTAE(in_channels=128, n_head=16, d_k=8, n_neurons=(256, 128), dropout=0.2, d_model=256, T=1000, len_max_seq=24, positions=None)[source]#

Bases: Module

Lightweight Temporal Attention Encoder (L-TAE).

This model implements a lightweight temporal attention encoder that processes time series data using a multi-head attention mechanism. It is designed to efficiently encode temporal sequences into fixed-length embeddings.

If you use this model in your research, please cite the following paper:

Added in version 0.8.

__init__(in_channels=128, n_head=16, d_k=8, n_neurons=(256, 128), dropout=0.2, d_model=256, T=1000, len_max_seq=24, positions=None)[source]#

Sequence-to-embedding encoder.

Parameters:
  • in_channels (int) – Number of channels of the input embeddings

  • n_head (int) – Number of attention heads

  • d_k (int) – Dimension of the key and query vectors

  • n_neurons (Sequence[int]) – Defines the dimensions of the successive feature spaces of the MLP that processes the concatenated outputs of the attention heads

  • dropout (float) – dropout

  • T (int) – Period to use for the positional encoding

  • len_max_seq (int) – Maximum sequence length, used to pre-compute the positional encoding table

  • positions (Sequence[int] | None) – List of temporal positions to use instead of position in the sequence

  • d_model (int | None) – If specified, the input tensors will first processed by a fully connected layer to project them into a feature space of dimension d_model

forward(x)[source]#

Forward pass of the model.

Parameters:

x (Tensor) – Input tensor of shape (batch_size, seq_len, in_channels)

Returns:

Output tensor of shape (batch_size, n_neurons[-1])

Return type:

Tensor