Shortcuts

BGenerator

class torcheeg.models.BGenerator(in_channels: int = 128, out_channels: int = 4, grid_size: Tuple[int, int] = (9, 9))[source][source]

TorchEEG provides an EEG feature generator based on CNN architecture and GAN for generating EEG grid representations of different frequency bands based on a given class label.

g_model = BGenerator(in_channels=128)
z = torch.normal(mean=0, std=1, size=(1, 128))
fake_X = g_model(z)
Parameters
  • in_channels (int) – The input feature dimension (of noise vectors). (defualt: 128)

  • out_channels (int) – The generated feature dimension of each electrode. (defualt: 4)

  • grid_size (tuple) – Spatial dimensions of grid-like EEG representation. (defualt: (9, 9))

forward(x: Tensor)[source][source]
Parameters

x (torch.Tensor) – a random vector, the ideal input shape is [n, 128]. Here, n corresponds to the batch size, and 128 corresponds to in_channels.

Returns

the generated fake EEG signals. Here, 4 corresponds to the out_channels, and (9, 9) corresponds to the grid_size.

Return type

torch.Tensor[n, 4, 9, 9]

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