Skip to content

Commit

Permalink
Use pytorch randint for ResizeSignalpt (#103)
Browse files Browse the repository at this point in the history
See this comment for the issue: #96 (comment)
  • Loading branch information
filipmu committed Sep 29, 2021
1 parent e7a9caa commit 3d6c0a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fastaudio/augment/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def encodes(self, ai: AudioTensor) -> AudioTensor:
elif orig_samples < crop_samples:
ai.data = _tfm_pad_signal(sig, crop_samples, pad_mode=self.pad_mode)
else:
crop_start = random.randint(0, int(orig_samples - crop_samples))
crop_start = torch.randint(0, int(orig_samples - crop_samples),(1,)).item()
ai.data = sig[:, crop_start : crop_start + crop_samples]
return ai

Expand Down

0 comments on commit 3d6c0a0

Please sign in to comment.