Browse Source

stft.py: moving window_sum to cuda if magnitude is cuda

master
rafaelvalle 5 years ago
parent
commit
fc0d34cfce
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      stft.py

+ 1
- 0
stft.py View File

@ -124,6 +124,7 @@ class STFT(torch.nn.Module):
np.where(window_sum > tiny(window_sum))[0]) np.where(window_sum > tiny(window_sum))[0])
window_sum = torch.autograd.Variable( window_sum = torch.autograd.Variable(
torch.from_numpy(window_sum), requires_grad=False) torch.from_numpy(window_sum), requires_grad=False)
window_sum = window_sum.cuda() if magnitude.is_cuda else window_sum
inverse_transform[:, :, approx_nonzero_indices] /= window_sum[approx_nonzero_indices] inverse_transform[:, :, approx_nonzero_indices] /= window_sum[approx_nonzero_indices]
# scale by hop ratio # scale by hop ratio

Loading…
Cancel
Save