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

Class UVit2DConvEmbed

src/diffusers/models/unets/uvit_2d.py:229–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228
229class UVit2DConvEmbed(nn.Module):
230 def __init__(self, in_channels, block_out_channels, vocab_size, elementwise_affine, eps, bias):
231 super().__init__()
232 self.embeddings = nn.Embedding(vocab_size, in_channels)
233 self.layer_norm = RMSNorm(in_channels, eps, elementwise_affine)
234 self.conv = nn.Conv2d(in_channels, block_out_channels, kernel_size=1, bias=bias)
235
236 def forward(self, input_ids):
237 embeddings = self.embeddings(input_ids)
238 embeddings = self.layer_norm(embeddings)
239 embeddings = embeddings.permute(0, 3, 1, 2)
240 embeddings = self.conv(embeddings)
241 return embeddings
242
243
244class UVitBlock(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…