Shortcuts

TSLANet

class torcheeg.models.TSLANet(chunk_size: int = 3000, patch_size: int = 200, num_electrodes: int = 1, emb_dim: int = 128, dropout_rate: float = 0.15, depth: int = 2, num_classes: int = 2)[source][source]

A time series lightweight adaptive network for EEG classification. For more details, please refer to the following information.

Below is a quick start example:

from torcheeg.models import TSLANet

model = TSLANet(num_classes=5,
               chunk_size=3000,
               patch_size=200,
               num_electrodes=1)

# batch_size, num_electrodes, chunk_size
x = torch.randn(32, 1, 3000)
model(x)
Parameters:
  • chunk_size (int) – Number of data points in each EEG segment. (default: 3000)

  • patch_size (int) – Size of each patch the input sequence is divided into. (default: 200)

  • num_electrodes (int) – The number of EEG channels. (default: 6)

  • emb_dim (int) – Dimension of the embedding space. (default: 128)

  • dropout_rate (float) – Dropout rate for regularization. (default: 0.15)

  • depth (int) – Number of TSLANet layers in the network. (default: 2)

  • num_classes (int) – The number of classes to classify. (default: 2)

forward(x)[source][source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources