🐛 Bug
Consider a situation when applying torch.stft to audio x, which is in CUDA memory. We also have a given tensor window, which is not in CUDA memory yet.
When n_fft is equal to win_length, it causes RuntimeError: expected device cuda:0 but got device cpu.
To Reproduce
See my Google Colab notebook:
https://colab.research.google.com/drive/15ZOc5SnFwXsb3-vgIbzdd2roeY6kOV2H
import torch
import librosa
print(torch.__version__) # 1.3.1
print(librosa.__version__) # 0.6.3
x, sr = librosa.load(librosa.util.example_audio_file(), offset=15.0, duration=5.0)
print(x.shape) # (110250,)
x = torch.from_numpy(x).cuda()
window = torch.hann_window(window_length=400)
torch.stft(x, n_fft=512, hop_length=160, win_length=400, window=window).shape # torch.Size([257, 690, 2])
torch.stft(x, n_fft=400, hop_length=160, win_length=400, window=window).shape # RuntimeError: expected device cuda:0 but got device cpu
Expected behavior
No error is expected here.
cc @mruberry @peterbell10
🐛 Bug
Consider a situation when applying
torch.stftto audiox, which is in CUDA memory. We also have a given tensorwindow, which is not in CUDA memory yet.When
n_fftis equal towin_length, it causesRuntimeError: expected device cuda:0 but got device cpu.To Reproduce
See my Google Colab notebook:
https://colab.research.google.com/drive/15ZOc5SnFwXsb3-vgIbzdd2roeY6kOV2H
Expected behavior
No error is expected here.
cc @mruberry @peterbell10