Skip to content

Commit f3a8f5f

Browse files
committed
pytorch update
1 parent ce3a1bb commit f3a8f5f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

dca/dca.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def make_cepts2(X, T_pi):
293293
# Compute the power spectral density
294294
window = torch.Tensor(hann(Y.shape[-1])[np.newaxis, np.newaxis]).type(Y.dtype)
295295
Yf = torch.fft.rfft(Y * window, dim=1)
296-
spect = Yf[:, :, :, 0]**2 + Yf[:, :, :, 1]**2
296+
spect = abs(Yf)**2
297297
spect = spect.mean(dim=1)
298298
spect = torch.cat([torch.flip(spect[:, 1:], dims=(1,)), spect], dim=1)
299299

@@ -302,7 +302,7 @@ def make_cepts2(X, T_pi):
302302

303303
# Compute squared cepstral coefs (b_k^2)
304304
cepts = torch.fft.rfft(logspect, dim=1) / float(Y.shape[-1])
305-
cepts = torch.sqrt(cepts[:, :, 0]**2 + cepts[:, :, 1]**2)
305+
cepts = abs(cepts)
306306
return cepts**2
307307

308308

0 commit comments

Comments
 (0)