Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mddct committed Mar 2, 2024
1 parent f56726b commit 958b0b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wenet/dataset/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ def compute_log_mel_spectrogram(sample,
waveform = F.pad(waveform, (0, padding))
if pad_or_trim:
length = max_duration * sample_rate
if waveform.size(1) >= length:
waveform = waveform[:, :length]
if waveform.size(0) >= length:
waveform = waveform[:length]
else:
waveform = F.pad(waveform, (0, length - waveform.size(1)))
waveform = F.pad(waveform, (0, length - waveform.size(0)))

window = torch.hann_window(n_fft)
stft = torch.stft(waveform,
Expand Down

0 comments on commit 958b0b6

Please sign in to comment.