Sine_source, noise_source = SourceModuleHnNSF(F0_sampled) F0_sampled (batchsize, length, 1) Sine_source (batchsize, length, 1) noise_source (batchsize, length 1)
(self, x)
| 239 | self.l_tanh = nn.Tanh() |
| 240 | |
| 241 | def forward(self, x): |
| 242 | """ |
| 243 | Sine_source, noise_source = SourceModuleHnNSF(F0_sampled) |
| 244 | F0_sampled (batchsize, length, 1) |
| 245 | Sine_source (batchsize, length, 1) |
| 246 | noise_source (batchsize, length 1) |
| 247 | """ |
| 248 | # source for harmonic branch |
| 249 | with torch.no_grad(): |
| 250 | sine_wavs, uv, _ = self.l_sin_gen(x) |
| 251 | sine_merge = self.l_tanh(self.l_linear(sine_wavs)) |
| 252 | # source for noise branch, in the same shape as uv |
| 253 | noise = torch.randn_like(uv) * self.sine_amp / 3 |
| 254 | return sine_merge, noise, uv |
| 255 | |
| 256 | |
| 257 | class Generator(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected