(self, x, cond_embeds)
| 425 | self.cond_embeds_mapper = nn.Linear(hidden_size, channels * 2, use_bias) |
| 426 | |
| 427 | def forward(self, x, cond_embeds): |
| 428 | x_res = x |
| 429 | |
| 430 | x = self.depthwise(x) |
| 431 | |
| 432 | x = x.permute(0, 2, 3, 1) |
| 433 | x = self.norm(x) |
| 434 | |
| 435 | x = self.channelwise_linear_1(x) |
| 436 | x = self.channelwise_act(x) |
| 437 | x = self.channelwise_norm(x) |
| 438 | x = self.channelwise_linear_2(x) |
| 439 | x = self.channelwise_dropout(x) |
| 440 | |
| 441 | x = x.permute(0, 3, 1, 2) |
| 442 | |
| 443 | x = x + x_res |
| 444 | |
| 445 | scale, shift = self.cond_embeds_mapper(F.silu(cond_embeds)).chunk(2, dim=1) |
| 446 | x = x * (1 + scale[:, :, None, None]) + shift[:, :, None, None] |
| 447 | |
| 448 | return x |
| 449 | |
| 450 | |
| 451 | class ConvMlmLayer(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected