braindecode.functional.prefer_fft_conv#

braindecode.functional.prefer_fft_conv(x, kernel_size)[source]#

Whether fft_conv1d() is expected to beat a direct convolution.

Rule measured for EEGInceptionMI (48 to 240 channels, 128-500 Hz, 2 CPU threads, oneDNN on and off): on CPU the FFT wins for float16/bfloat16 inputs (no fast half-precision CPU convolution) and from batch_size * kernel_size >= 600 if also in_channels * kernel_size >= 120: with one or two input channels a float32 direct convolution stays cheaper up to k = 85 / 31 (13 long temporal convolutions of the model zoo, 22 channels x batch 32). GPUs and HPUs (no complex dtype) keep the direct convolution.

Parameters:
  • x (Tensor) – Input of the convolution, (batch, in_channels, n_times).

  • kernel_size (int) – Kernel length in samples.

Return type:

bool