Skip to content

Commit 6aab41f

Browse files
committed
discard negative pad
1 parent a2b1a55 commit 6aab41f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/nsf_HiFigan/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _f02sine(self, f0, upp):
129129
rad = f0 / self.sampling_rate * torch.arange(1, upp + 1, device=f0.device)
130130
rad2 = torch.fmod(rad[..., -1:].float() + 0.5, 1.0) - 0.5
131131
rad_acc = rad2.cumsum(dim=1).fmod(1.0).to(f0)
132-
rad += F.pad(rad_acc, (0, 0, 1, -1))
132+
rad += F.pad(rad_acc[:, :-1, :], (0, 0, 1, 0))
133133
rad = rad.reshape(f0.shape[0], -1, 1)
134134
rad = torch.multiply(rad, torch.arange(1, self.dim + 1, device=f0.device).reshape(1, 1, -1))
135135
rand_ini = torch.rand(1, 1, self.dim, device=f0.device)
@@ -249,7 +249,7 @@ def fastsinegen(self, f0):
249249
rad = s0 * n + 0.5 * ds0 * n * (n - 1) / self.upp
250250
rad2 = torch.fmod(rad[..., -1:].float() + 0.5, 1.0) - 0.5
251251
rad_acc = rad2.cumsum(dim=1).fmod(1.0).to(f0)
252-
rad += F.pad(rad_acc, (0, 0, 1, -1))
252+
rad += F.pad(rad_acc[:, :-1, :], (0, 0, 1, 0))
253253
rad = rad.reshape(f0.shape[0], 1, -1)
254254
sines = torch.sin(2 * np.pi * rad)
255255
return sines

0 commit comments

Comments
 (0)