debug 反量化 我发现flow里面有反量化的代码

This commit is contained in:
ylzz1997
2023-08-30 02:02:52 +08:00
parent c3e442ab9c
commit 6b9f4d11d2

View File

@@ -665,12 +665,13 @@ class SynthesizerTrn(nn.Module):
attn = monotonic_align.maximum_path(neg_cent, attn_mask.squeeze(1)).unsqueeze(1).detach()
w = attn.sum(2)
# 反量化
w -= torch.rand_like(w)
l_length_sdp = self.sdp(x, x_mask, w, g=g)
l_length_sdp = l_length_sdp / torch.sum(x_mask)
# 反量化
w -= torch.rand_like(w)
logw_ = torch.log(w + 1e-6) * x_mask
logw = self.dp(x, x_mask, g=g)
l_length_dp = torch.sum((logw - logw_) ** 2, [1, 2]) / torch.sum(x_mask) # for averaging