(self, text_embeds: torch.FloatTensor, image_embeds: torch.FloatTensor)
| 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 | |
| 442 | class ImageProjection(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected