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

Method forward

diffsynth/models/sd_unet.py:108–123  ·  view source on GitHub ↗
(self, hidden_states, time_emb, text_emb, res_stack, **kwargs)

Source from the content-addressed store, hash-verified

106 self.conv_shortcut = torch.nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, bias=True)
107
108 def forward(self, hidden_states, time_emb, text_emb, res_stack, **kwargs):
109 x = hidden_states
110 x = self.norm1(x)
111 x = self.nonlinearity(x)
112 x = self.conv1(x)
113 if time_emb is not None:
114 emb = self.nonlinearity(time_emb)
115 emb = self.time_emb_proj(emb)[:, :, None, None]
116 x = x + emb
117 x = self.norm2(x)
118 x = self.nonlinearity(x)
119 x = self.conv2(x)
120 if self.conv_shortcut is not None:
121 hidden_states = self.conv_shortcut(hidden_states)
122 hidden_states = hidden_states + x
123 return hidden_states, time_emb, text_emb, res_stack
124
125
126class AttentionBlock(torch.nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected