From 9f16b25ce522dad8578fdffe12e51d804c1796ae Mon Sep 17 00:00:00 2001 From: James Betker Date: Mon, 23 May 2022 08:21:27 -0600 Subject: [PATCH] introduce prepadlength --- codes/data/audio/unsupervised_audio_dataset.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codes/data/audio/unsupervised_audio_dataset.py b/codes/data/audio/unsupervised_audio_dataset.py index 7b1dbb70..284e402e 100644 --- a/codes/data/audio/unsupervised_audio_dataset.py +++ b/codes/data/audio/unsupervised_audio_dataset.py @@ -147,6 +147,7 @@ class UnsupervisedAudioDataset(torch.utils.data.Dataset): # To increase variability, which skew is applied to the clip and resampled_clip is randomized. random.shuffle(skew) clips = [] + prepad_length = min(audio_norm.shape[-1], self.pad_to) for sk in skew: if self.pad_to is not None: if audio_norm.shape[-1] <= self.pad_to: @@ -159,6 +160,7 @@ class UnsupervisedAudioDataset(torch.utils.data.Dataset): clips.append(audio_norm) output = { + 'prepad_length': prepad_length, 'clip': clips[0], 'clip_lengths': torch.tensor(audio_norm.shape[-1]), 'path': filename,