braindecode.functional.spectral_input#
- braindecode.functional.spectral_input(x)[source]#
Prepare
xfor an FFT, STFT or eigendecomposition.PyTorch has no complex bfloat16 dtype: CPU and MPS FFTs reject bfloat16/float16, and Intel Gaudi (HPU) has no complex tensors at all. This returns
xin at least float32, moved to the CPU when it lives on an HPU; float32/float64 CPU/CUDA inputs are returned as they are. Cast a real result back with.to(x)(the input’s dtype and device):spectrum = torch.fft.rfft(spectral_input(x), dim=-1).abs().to(x)