MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / AdaLayerNorm

Class AdaLayerNorm

kokoro/modules.py:72–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72class AdaLayerNorm(nn.Module):
73 def __init__(self, style_dim, channels, eps=1e-5):
74 super().__init__()
75 self.channels = channels
76 self.eps = eps
77 self.fc = nn.Linear(style_dim, channels*2)
78
79 def forward(self, x, s):
80 x = x.transpose(-1, -2)
81 x = x.transpose(1, -1)
82 h = self.fc(s)
83 h = h.view(h.size(0), h.size(1), 1)
84 gamma, beta = torch.chunk(h, chunks=2, dim=1)
85 gamma, beta = gamma.transpose(1, -1), beta.transpose(1, -1)
86 x = F.layer_norm(x, (self.channels,), eps=self.eps)
87 x = (1 + gamma) * x + beta
88 return x.transpose(1, -1).transpose(-1, -2)
89
90
91class ProsodyPredictor(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected