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

Method forward

usr/diff/net.py:107–130  ·  view source on GitHub ↗

:param spec: [B, 1, M, T] :param diffusion_step: [B, 1] :param cond: [B, M, T] :return:

(self, spec, diffusion_step, cond)

Source from the content-addressed store, hash-verified

105 nn.init.zeros_(self.output_projection.weight)
106
107 def forward(self, spec, diffusion_step, cond):
108 """
109
110 :param spec: [B, 1, M, T]
111 :param diffusion_step: [B, 1]
112 :param cond: [B, M, T]
113 :return:
114 """
115 x = spec[:, 0]
116 x = self.input_projection(x) # x [B, residual_channel, T]
117
118 x = F.relu(x)
119 diffusion_step = self.diffusion_embedding(diffusion_step)
120 diffusion_step = self.mlp(diffusion_step)
121 skip = []
122 for layer_id, layer in enumerate(self.residual_layers):
123 x, skip_connection = layer(x, cond, diffusion_step)
124 skip.append(skip_connection)
125
126 x = torch.sum(torch.stack(skip), dim=0) / sqrt(len(self.residual_layers))
127 x = self.skip_projection(x)
128 x = F.relu(x)
129 x = self.output_projection(x) # [B, 80, T]
130 return x[:, None, :, :]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected