"git@developer.sourcefind.cn:modelzoo/starcoder2_pytorch.git" did not exist on "d12211042e8f1d8eaed10dbfd240c1e53ba0227c"
Unverified Commit 8d2eeb11 authored by Chin-Yun Yu's avatar Chin-Yun Yu Committed by GitHub
Browse files

Refactor implementation of F.compute_deltas (#1423)

parent e964f93c
...@@ -793,7 +793,7 @@ def compute_deltas( ...@@ -793,7 +793,7 @@ def compute_deltas(
# pack batch # pack batch
shape = specgram.size() shape = specgram.size()
specgram = specgram.reshape(1, -1, shape[-1]) specgram = specgram.reshape(-1, 1, shape[-1])
assert win_length >= 3 assert win_length >= 3
...@@ -804,9 +804,9 @@ def compute_deltas( ...@@ -804,9 +804,9 @@ def compute_deltas(
specgram = torch.nn.functional.pad(specgram, (n, n), mode=mode) specgram = torch.nn.functional.pad(specgram, (n, n), mode=mode)
kernel = torch.arange(-n, n + 1, 1, device=device, dtype=dtype).repeat(specgram.shape[1], 1, 1) kernel = torch.arange(-n, n + 1, 1, device=device, dtype=dtype).view(1, 1, -1)
output = torch.nn.functional.conv1d(specgram, kernel, groups=specgram.shape[1]) / denom output = torch.nn.functional.conv1d(specgram, kernel) / denom
# unpack batch # unpack batch
output = output.reshape(shape) output = output.reshape(shape)
......
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