(self, image, no_dropout=False)
| 131 | param.requires_grad = False |
| 132 | |
| 133 | def forward(self, image, no_dropout=False): |
| 134 | z = self.encode_with_vision_transformer(image) |
| 135 | if self.ucg_rate > 0. and not no_dropout: |
| 136 | z = torch.bernoulli((1. - self.ucg_rate) * torch.ones(z.shape[0], device=z.device))[:, None] * z |
| 137 | return z.unsqueeze(1) |
| 138 | |
| 139 | def encode_with_vision_transformer(self, img): |
| 140 | img = self.preprocess(img) |
nothing calls this directly
no test coverage detected