"common/vscode:/vscode.git/clone" did not exist on "d5e51aa9f0e354f1acb5f42c88890ff899ed832b"
Unverified Commit 265bc5ca authored by Zhenyu Tang's avatar Zhenyu Tang Committed by GitHub
Browse files

Fix incorrect audio trimming with negative index

Differential Revision: D67155973

Pull Request resolved: https://github.com/pytorch/audio/pull/3860
parent 332760d4
...@@ -1665,6 +1665,6 @@ def vad( ...@@ -1665,6 +1665,6 @@ def vad(
if not has_triggered: if not has_triggered:
return waveform[..., :0].view(shape[:-1] + torch.Size([0])) return waveform[..., :0].view(shape[:-1] + torch.Size([0]))
res = waveform[:, pos - samplesLen_ns + flushedLen_ns :] res = waveform[:, max(pos - samplesLen_ns + flushedLen_ns, 0) :]
# unpack batch # unpack batch
return res.view(shape[:-1] + res.shape[-1:]) return res.view(shape[:-1] + res.shape[-1:])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment