MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / forward

Method forward

diffsynth/models/svd_unet.py:20–37  ·  view source on GitHub ↗
(self, hidden_states, time_emb, text_emb, res_stack, **kwargs)

Source from the content-addressed store, hash-verified

18 self.conv_shortcut = torch.nn.Conv3d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, bias=True)
19
20 def forward(self, hidden_states, time_emb, text_emb, res_stack, **kwargs):
21 x = rearrange(hidden_states, "f c h w -> 1 c f h w")
22 x = self.norm1(x)
23 x = self.nonlinearity(x)
24 x = self.conv1(x)
25 if time_emb is not None:
26 emb = self.nonlinearity(time_emb)
27 emb = self.time_emb_proj(emb)
28 emb = repeat(emb, "b c -> b c f 1 1", f=hidden_states.shape[0])
29 x = x + emb
30 x = self.norm2(x)
31 x = self.nonlinearity(x)
32 x = self.conv2(x)
33 if self.conv_shortcut is not None:
34 hidden_states = self.conv_shortcut(hidden_states)
35 x = rearrange(x[0], "c f h w -> f c h w")
36 hidden_states = hidden_states + x
37 return hidden_states, time_emb, text_emb, res_stack
38
39
40def get_timestep_embedding(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected