braindecode.modules.SRM#

class braindecode.modules.SRM(in_channels, use_mlp=False, reduction_rate=4, bias=False)[source]#

Attention module from [Lee2019].

Parameters:
  • in_channels (int) – number of input feature channels

  • use_mlp (bool, default=False) – whether to use fully-connected layers instead of a convolutional layer,

  • reduction_rate (int, default=4) – reduction ratio of the fully-connected layers (if used),

Examples

>>> import torch
>>> from braindecode.modules import SRM
>>> module = SRM(in_channels=16, use_mlp=False)
>>> inputs = torch.randn(2, 16, 1, 64)
>>> outputs = module(inputs)
>>> outputs.shape
torch.Size([2, 16, 1, 64])

References

[Lee2019]

Lee, H., Kim, H., Nam, H., 2019. SRM: A Style-based Recalibration Module for Convolutional Neural Networks. ICCV 2019.

Methods

forward(x)[source]#

Apply the Style-based Recalibration Module to the input tensor.

Parameters:

x (Pytorch.Tensor)

Return type:

Pytorch.Tensor