fixed loss bugs

This commit is contained in:
SayanoAI
2024-09-06 00:21:13 -04:00
parent 4807a8caf8
commit 4ae5180c3a
4 changed files with 77 additions and 35 deletions
+3 -3
View File
@@ -74,7 +74,7 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
y = y.squeeze(1)
# Complex Spectrogram :: (B, T) -> (B, Freq, Frame, RealComplex=2)
spec = torch.stft(
spec = torch.view_as_real(torch.stft(
y,
n_fft,
hop_length=hop_size,
@@ -84,8 +84,8 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
pad_mode="reflect",
normalized=False,
onesided=True,
return_complex=False,
)
return_complex=True,
))
# Linear-frequency Linear-amplitude spectrogram :: (B, Freq, Frame, RealComplex=2) -> (B, Freq, Frame)
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)