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

Method forward

usr/diff/diffusion.py:57–64  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

55 self.dim = dim
56
57 def forward(self, x):
58 device = x.device
59 half_dim = self.dim // 2
60 emb = math.log(10000) / (half_dim - 1)
61 emb = torch.exp(torch.arange(half_dim, device=device) * -emb)
62 emb = x[:, None] * emb[None, :]
63 emb = torch.cat((emb.sin(), emb.cos()), dim=-1)
64 return emb
65
66
67class Mish(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected