mirror of https://github.com/coqui-ai/TTS.git
batch-wise operation
This commit is contained in:
parent
3a4a3e571a
commit
2586be7d33
|
@ -222,7 +222,11 @@ class Attention(nn.Module):
|
||||||
# force incremental alignment
|
# force incremental alignment
|
||||||
if not self.training:
|
if not self.training:
|
||||||
val, n = prev_alpha.max(1)
|
val, n = prev_alpha.max(1)
|
||||||
alignment[:, n+2 :] = 0
|
if alignment.shape[0] == 1:
|
||||||
|
alignment[:, n+2:] = 0
|
||||||
|
else:
|
||||||
|
for b in range(alignment.shape[0]):
|
||||||
|
alignment[b, n[b]+2:]
|
||||||
alpha = (((1 - self.u) * self.alpha.clone().to(inputs.device) +
|
alpha = (((1 - self.u) * self.alpha.clone().to(inputs.device) +
|
||||||
self.u * prev_alpha) + 1e-8) * alignment
|
self.u * prev_alpha) + 1e-8) * alignment
|
||||||
self.alpha = alpha / alpha.sum(dim=1).unsqueeze(1)
|
self.alpha = alpha / alpha.sum(dim=1).unsqueeze(1)
|
||||||
|
|
Loading…
Reference in New Issue