File size: 467 Bytes
c42fe7e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import torch

from modules.nsf_hifigan.env import AttrDict
from modules.nsf_hifigan.models import Generator


# noinspection SpellCheckingInspection
class NSFHiFiGANONNX(torch.nn.Module):
    def __init__(self, attrs: dict):
        super().__init__()
        self.generator = Generator(AttrDict(attrs))

    def forward(self, mel: torch.Tensor, f0: torch.Tensor):
        mel = mel.transpose(1, 2)
        wav = self.generator(mel, f0)
        return wav.squeeze(1)