imgs: [B, 3, H, W] of torch.float32. - mean: [0.48145466, 0.4578275, 0.40821073] - std: [0.26862954, 0.26130258, 0.27577711] txt_ids: [B, L] of torch.long. Encoded by data.CLIPTokenizer.
(self, imgs, txt_ids)
| 569 | self.init_weights() |
| 570 | |
| 571 | def forward(self, imgs, txt_ids): |
| 572 | """ |
| 573 | imgs: [B, 3, H, W] of torch.float32. |
| 574 | - mean: [0.48145466, 0.4578275, 0.40821073] |
| 575 | - std: [0.26862954, 0.26130258, 0.27577711] |
| 576 | txt_ids: [B, L] of torch.long. Encoded by data.CLIPTokenizer. |
| 577 | """ |
| 578 | xi = self.visual(imgs) |
| 579 | xt = self.textual(txt_ids) |
| 580 | return xi, xt |
| 581 | |
| 582 | def init_weights(self): |
| 583 | # embeddings |