MCPcopy Create free account
hub / github.com/huggingface/diffusers / forward

Method forward

src/diffusers/models/unets/uvit_2d.py:323–340  ·  view source on GitHub ↗
(self, x, pooled_text_emb, encoder_hidden_states, cross_attention_kwargs)

Source from the content-addressed store, hash-verified

321 self.upsample = None
322
323 def forward(self, x, pooled_text_emb, encoder_hidden_states, cross_attention_kwargs):
324 if self.downsample is not None:
325 x = self.downsample(x)
326
327 for res_block, attention_block in zip(self.res_blocks, self.attention_blocks):
328 x = res_block(x, pooled_text_emb)
329
330 batch_size, channels, height, width = x.shape
331 x = x.view(batch_size, channels, height * width).permute(0, 2, 1)
332 x = attention_block(
333 x, encoder_hidden_states=encoder_hidden_states, cross_attention_kwargs=cross_attention_kwargs
334 )
335 x = x.permute(0, 2, 1).view(batch_size, channels, height, width)
336
337 if self.upsample is not None:
338 x = self.upsample(x)
339
340 return x
341
342
343class ConvNextBlock(nn.Module):

Callers

nothing calls this directly

Calls 1

downsampleMethod · 0.80

Tested by

no test coverage detected