MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / out2dur

Method out2dur

modules/fastspeech/tts_modules.py:122–131  ·  view source on GitHub ↗
(self, xs)

Source from the content-addressed store, hash-verified

120 return xs
121
122 def out2dur(self, xs):
123 if hparams['dur_loss'] in ['mse']:
124 # NOTE: calculate in log domain
125 xs = xs.squeeze(-1) # (B, Tmax)
126 dur = torch.clamp(torch.round(xs.exp() - self.offset), min=0).long() # avoid negative value
127 elif hparams['dur_loss'] == 'mog':
128 return NotImplementedError
129 elif hparams['dur_loss'] == 'crf':
130 dur = torch.LongTensor(self.crf.decode(xs)).cuda()
131 return dur
132
133 def forward(self, xs, x_masks=None):
134 """Calculate forward propagation.

Callers 2

_forwardMethod · 0.95
plot_durMethod · 0.80

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected