Skip to content

Commit c61bf32

Browse files
committed
optimize code
1 parent 5c7290c commit c61bf32

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

modules/nsf_hifigan/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,8 @@ def forward(self, f0):
249249
output uv: tensor(batchsize=1, length, 1)
250250
"""
251251
with torch.no_grad():
252-
f0_buf = torch.zeros(f0.shape[0], f0.shape[1], self.dim,
253-
device=f0.device)
254252
# fundamental component
255-
fn = torch.multiply(f0, torch.FloatTensor([[range(1, self.harmonic_num + 2)]]).to(f0.device))
253+
fn = torch.multiply(f0, torch.arange(1, self.harmonic_num + 2, device=f0.device))
256254

257255
# generate sine waveforms
258256
sine_waves = self._f02sine(fn) * self.sine_amp

0 commit comments

Comments
 (0)