braindecode.modules.DepthwiseConv2d#

class braindecode.modules.DepthwiseConv2d(in_channels, depth_multiplier=2, kernel_size=3, stride=1, padding=0, dilation=1, bias=True, padding_mode='zeros')[source]#

Depthwise convolution layer.

This class implements a depthwise convolution, where each input channel is convolved separately with its own filter (channel multiplier), effectively performing a spatial convolution independently over each channel.

Parameters:
  • in_channels (int) – Number of channels in the input tensor.

  • depth_multiplier (int, optional) – Multiplier for the number of output channels. The total number of output channels will be in_channels * depth_multiplier. Default is 2.

  • kernel_size (int or tuple, optional) – Size of the convolutional kernel. Default is 3.

  • stride (int or tuple, optional) – Stride of the convolution. Default is 1.

  • padding (int or tuple, optional) – Padding added to both sides of the input. Default is 0.

  • dilation (int or tuple, optional) – Spacing between kernel elements. Default is 1.

  • bias (bool, optional) – If True, adds a learnable bias to the output. Default is True.

  • padding_mode (str, optional) – Padding mode to use. Options are ‘zeros’, ‘reflect’, ‘replicate’, or ‘circular’. Default is ‘zeros’.