MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / forward

Method forward

diffusers/src/diffusers/models/unets/uvit_2d.py:427–448  ·  view source on GitHub ↗
(self, x, cond_embeds)

Source from the content-addressed store, hash-verified

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
451class ConvMlmLayer(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected