StagerNetEncoder

class selfeeg.models.encoders.StagerNetEncoder(Chans, kernLength: int = 64, F: int = 8, Pool: int = 16, seed: int = None)[source]

Pytorch implementation of the StagerNet Encoder.

See TinySleepNet for some references. The expected input is a 3D tensor with size (Batch x Channels x Samples).

Parameters:
  • Chans (int) – The number of EEG channels.

  • kernlength (int, optional) –

    The length of the temporal convolutional layer.

    Default = 8

  • F (int, optional) –

    The number of output filters in the temporal convolution layer.

    Default = 128

  • pool (int, optional) –

    The temporal pooling kernel size.

    Default = 4

  • seed (int, optional) –

    A custom seed for model initialization. It must be a nonnegative number. If None is passed, no custom seed will be set

    Default = None

Example

>>> import selfeeg.models
>>> import torch
>>> x = torch.randn(4,8,512)
>>> mdl = models.StagerNetEncoder(8)
>>> out = mdl(x)
>>> print(out.shape) # shoud return torch.Size([4, 128])
>>> print(torch.isnan(out).sum()) # shoud return 0