MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / forward

Method forward

src/diffusers/models/embeddings.py:429–439  ·  view source on GitHub ↗
(self, text_embeds: torch.FloatTensor, image_embeds: torch.FloatTensor)

Source from the content-addressed store, hash-verified

427 self.text_proj = nn.Linear(text_embed_dim, cross_attention_dim)
428
429 def forward(self, text_embeds: torch.FloatTensor, image_embeds: torch.FloatTensor):
430 batch_size = text_embeds.shape[0]
431
432 # image
433 image_text_embeds = self.image_embeds(image_embeds)
434 image_text_embeds = image_text_embeds.reshape(batch_size, self.num_image_text_embeds, -1)
435
436 # text
437 text_embeds = self.text_proj(text_embeds)
438
439 return torch.cat([image_text_embeds, text_embeds], dim=1)
440
441
442class ImageProjection(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected